setup.py
author robin
Mon, 21 Nov 2022 10:58:04 +0000
branch3.6.13
changeset 4745 bbe50343dd16
parent 4742 dbdba710a163
permissions -rw-r--r--
start branch 3.6.13; tables.py error improvements and test exclusions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4685
a6efa1479aa4 add musllinux and exotic builds
robin
parents: 4682
diff changeset
     1
#Copyright ReportLab Europe Ltd. 2000-2021
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     2
#see license.txt for license details
4745
bbe50343dd16 start branch 3.6.13; tables.py error improvements and test exclusions
robin
parents: 4742
diff changeset
     3
__version__='3.6.13'
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
     4
import os, sys, glob, shutil, re, sysconfig, traceback, io, subprocess
4710
5d3c80a9e519 remove old Python2 constructs; patch from Claude Paroz < claude at 2xlibre dot net >; version --> 3.6.8
robin
parents: 4692
diff changeset
     5
from configparser import RawConfigParser
5d3c80a9e519 remove old Python2 constructs; patch from Claude Paroz < claude at 2xlibre dot net >; version --> 3.6.8
robin
parents: 4692
diff changeset
     6
from urllib.parse import quote as urlquote
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
     7
platform = sys.platform
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
     8
pjoin = os.path.join
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
     9
abspath = os.path.abspath
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    10
isfile = os.path.isfile
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    11
isdir = os.path.isdir
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    12
dirname = os.path.dirname
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    13
basename = os.path.basename
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    14
splitext = os.path.splitext
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
    15
addrSize = 64 if sys.maxsize > 2**32 else 32
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
    16
sysconfig_platform = sysconfig.get_platform()
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    17
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    18
INFOLINES=[]
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    19
def infoline(t,
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    20
        pfx='#####',
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    21
        add=True,
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    22
        ):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    23
    bn = splitext(basename(sys.argv[0]))[0]
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    24
    ver = '.'.join(map(str,sys.version_info[:3]))
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
    25
    s = '%s %s-python-%s-%s: %s' % (pfx, bn, ver, sysconfig_platform, t)
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    26
    print(s)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    27
    if add: INFOLINES.append(s)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    28
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    29
def showTraceback(s):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    30
    buf = io.StringIO()
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    31
    print(s,file=buf)
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    32
    if verbose>2:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    33
        traceback.print_exc(file=buf)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    34
    for l in buf.getvalue().split('\n'):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    35
        infoline(l,pfx='!!!!!',add=False)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    36
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    37
def spCall(cmd,*args,**kwds):
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    38
    r = subprocess.call(
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    39
            cmd,
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    40
            stderr =subprocess.STDOUT,
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    41
            stdout = subprocess.DEVNULL if kwds.pop('dropOutput',False) else None,
4682
67da158484d2 change the default timeout for testing subprocesses
robin
parents: 4681
diff changeset
    42
            timeout = kwds.pop('timeout',3600),
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    43
            )
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    44
    if verbose>=3:
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    45
        infoline('%r --> %s' % (' '.join(cmd),r), pfx='!!!!!' if r else '#####', add=False)
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    46
    return r
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    47
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    48
def specialOption(n,ceq=False):
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    49
    v = 0
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    50
    while n in sys.argv:
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    51
        v += 1
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    52
        sys.argv.remove(n)
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    53
    if ceq:
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    54
        n += '='
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    55
        V = [_ for _ in sys.argv if _.startswith(n)]
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    56
        for _ in V: sys.argv.remove(_)
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    57
        if V:
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    58
            n = len(n)
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    59
            v = V[-1][n:]
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    60
    return v
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    61
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    62
#defaults for these options may be configured in local-setup.cfg
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    63
#[OPTIONS]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    64
#no-download-t1-files=yes
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    65
#ignore-system-libart=yes
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    66
# if used on command line the config values are not used
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    67
dlt1 = not specialOption('--no-download-t1-files')
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
    68
usla = specialOption('--use-system-libart')
4605
f8bb8ca3861d version --> 3.5.50
robin
parents: 4601
diff changeset
    69
mdbg = specialOption('--memory-debug')
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    70
verbose = specialOption('--verbose',ceq=True)
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
    71
nullDivert = not verbose
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    72
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    73
if __name__=='__main__':
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    74
    pkgDir=dirname(sys.argv[0])
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    75
else:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    76
    pkgDir=dirname(__file__)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    77
if not pkgDir:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    78
    pkgDir=os.getcwd()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    79
elif not os.path.isabs(pkgDir):
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    80
    pkgDir=abspath(pkgDir)
3168
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    81
try:
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    82
    os.chdir(pkgDir)
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    83
except:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
    84
    showTraceback('warning could not change directory to %r' % pkgDir)
4060
05188cfb93b2 setup.py: start using setuptools
robin
parents: 3974
diff changeset
    85
daily=int(os.environ.get('RL_EXE_DAILY','0'))
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    86
4061
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
    87
try:
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
    88
    from setuptools import setup, Extension
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
    89
except ImportError:
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
    90
    from distutils.core import setup, Extension
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    91
4665
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
    92
def _packages_path(d):
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
    93
    P = [_ for _ in sys.path if basename(_)==d]
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
    94
    if P: return P[0]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    95
4665
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
    96
package_path = _packages_path('dist-packages') or _packages_path('site-packages')
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
    97
package_path = pjoin(package_path, 'reportlab')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    98
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
    99
def die(msg):
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   100
    raise ValueError(msg)
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   101
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   102
def make_libart_config(src):
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   103
    from struct import calcsize as sizeof
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   104
    L=["""/* Automatically generated by setup.py */
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   105
#ifndef _ART_CONFIG_H
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   106
#\tdefine _ART_CONFIG_H
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   107
#\tdefine ART_SIZEOF_CHAR %d
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   108
#\tdefine ART_SIZEOF_SHORT %d
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   109
#\tdefine ART_SIZEOF_INT %d
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   110
#\tdefine ART_SIZEOF_LONG %d""" % (sizeof('c'), sizeof('h'), sizeof('i'), sizeof('l'))
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   111
        ]
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   112
    aL = L.append
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   113
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   114
    if sizeof('c')==1:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   115
        aL("typedef unsigned char art_u8;")
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   116
    else:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   117
        die("sizeof(char) != 1")
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   118
    if sizeof('h')==2:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   119
        aL("typedef unsigned short art_u16;")
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   120
    else:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   121
        die("sizeof(short) != 2")
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   122
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   123
    if sizeof('i')==4:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   124
        aL("typedef unsigned int art_u32;")
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   125
    elif sizeof('l')==4:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   126
        aL("typedef unsigned long art_u32;")
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   127
    else:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   128
        die("sizeof(int)!=4 and sizeof(long)!=4")
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   129
    aL('#endif\n')
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   130
    with open(pjoin(src,'art_config.h'),'w') as f:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   131
        f.write('\n'.join(L))
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   132
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   133
def get_version():
4685
a6efa1479aa4 add musllinux and exotic builds
robin
parents: 4682
diff changeset
   134
    #determine Version
3033
0c9602603837 setup.py: allow for daily builds having different version string
rgbecker
parents: 3028
diff changeset
   135
    if daily: return 'daily'
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   136
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   137
    #first try source
4685
a6efa1479aa4 add musllinux and exotic builds
robin
parents: 4682
diff changeset
   138
    FN = pjoin(pkgDir,'src','reportlab','__init__')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   139
    try:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   140
        for l in open(pjoin(FN+'.py'),'r').readlines():
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   141
            if l.startswith('Version'):
3724
8c3d733474a0 added fixed setup.py for Python-3.3
rptlab
parents: 3721
diff changeset
   142
                D = {}
8c3d733474a0 added fixed setup.py for Python-3.3
rptlab
parents: 3721
diff changeset
   143
                exec(l.strip(),D)
8c3d733474a0 added fixed setup.py for Python-3.3
rptlab
parents: 3721
diff changeset
   144
                return D['Version']
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   145
    except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   146
        pass
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   147
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   148
    #don't have source, try import
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   149
    import imp
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   150
    for desc in ('.pyc', 'rb', 2), ('.pyo', 'rb', 2):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   151
        try:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   152
            fn = FN+desc[0]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   153
            f = open(fn,desc[1])
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   154
            m = imp.load_module('reportlab',f,fn,desc)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   155
            return m.Version
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   156
        except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   157
            pass
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   158
    raise ValueError('Cannot determine ReportLab Version')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   159
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   160
class config:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   161
    def __init__(self):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   162
        try:
4710
5d3c80a9e519 remove old Python2 constructs; patch from Claude Paroz < claude at 2xlibre dot net >; version --> 3.6.8
robin
parents: 4692
diff changeset
   163
            self.parser = RawConfigParser()
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   164
            self.parser.read([pjoin(pkgDir,'setup.cfg'),pjoin(pkgDir,'local-setup.cfg')])
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   165
        except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   166
            self.parser = None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   167
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   168
    def __call__(self,sect,name,default=None):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   169
        try:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   170
            return self.parser.get(sect,name)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   171
        except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   172
            return default
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   173
config = config()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   174
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   175
if dlt1:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   176
    #not set on command line so try for config value
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   177
    dlt1 = not config('OPTIONS','no-download-t1-files','0').lower() in ('1','true','yes')
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   178
if not usla:
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   179
    #not set on command line so try for config value
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   180
    usla = config('OPTIONS','use-system-libart','0').lower() in ('1','true','yes')
4605
f8bb8ca3861d version --> 3.5.50
robin
parents: 4601
diff changeset
   181
if not mdbg:
f8bb8ca3861d version --> 3.5.50
robin
parents: 4601
diff changeset
   182
    mdbg = config('OPTIONS','memory-debug','0').lower() in ('1','true','yes')
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   183
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   184
#this code from /FBot's PIL setup.py
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   185
def aDir(P, d, x=None):
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   186
    if d and isdir(d) and d not in P:
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   187
        if x is None:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   188
            P.append(d)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   189
        else:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   190
            P.insert(x, d)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   191
4718
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   192
# protection against loops needed. reported by
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   193
# Michał Górny &lt; mgorny at gentoo dot org &gt;
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   194
# see https://stackoverflow.com/questions/36977259
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   195
def findFile(root, wanted, followlinks=True):
4718
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   196
    visited = set()
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   197
    for p, D, F in os.walk(root,followlinks=followlinks):
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   198
        #scan directories to check for prior visits
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   199
        #use dev/inode to make unique key
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   200
        SD = [].append
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   201
        for d in D:
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   202
            dk = os.stat(pjoin(p,d))
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   203
            dk = dk.st_dev, dk.st_ino
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   204
            if dk not in visited:
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   205
                visited.add(dk)
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   206
                SD(d)
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   207
        D[:] = SD.__self__  #set the dirs to be scanned
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   208
        for fn in F:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   209
            if fn==wanted:  
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   210
                return abspath(pjoin(p,fn))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   211
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   212
def listFiles(root,followlinks=True,strJoin=None):
4718
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   213
    visited = set()
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   214
    R = [].append
4718
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   215
    for p, D, F in os.walk(root,followlinks=followlinks):
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   216
        #scan directories to check for prior visits
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   217
        #use dev/inode to make unique key
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   218
        SD = [].append
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   219
        for d in D:
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   220
            dk = os.stat(pjoin(p,d))
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   221
            dk = dk.st_dev, dk.st_ino
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   222
            if dk not in visited:
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   223
                visited.add(dk)
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   224
                SD(d)
697141ce83e1 fix symlink looping in setup.py reported by Michał Górny < mgorny at gentoo dot org >
robin
parents: 4715
diff changeset
   225
        D[:] = SD.__self__  #set the dirs to be scanned
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   226
        for fn in F:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   227
            R(abspath(pjoin(p,fn)))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   228
    R = R.__self__
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   229
    return strJoin.join(R) if strJoin else R
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   230
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   231
def freetypeVersion(fn,default='20'):
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   232
    with open(fn,'r') as _:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   233
        text = _.read()
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   234
    pat = re.compile(r'^#define\s+FREETYPE_(?P<level>MAJOR|MINOR|PATCH)\s*(?P<value>\d*)\s*$',re.M)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   235
    locmap=dict(MAJOR=0,MINOR=1,PATCH=2)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   236
    loc = ['','','']
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   237
    for m in pat.finditer(text):
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   238
        loc[locmap[m.group('level')]] = m.group('value')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   239
    loc = list(filter(None,loc))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   240
    return '.'.join(loc) if loc else default
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   241
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   242
class inc_lib_dirs:
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   243
    def __call__(self,libname=None):
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   244
        L = config('FREETYPE_PATHS','lib')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   245
        L = [L] if L else []
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   246
        I = config('FREETYPE_PATHS','inc')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   247
        I = [I] if I else []
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   248
        if platform == "cygwin":
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   249
            aDir(L, os.path.join("/usr/lib", "python%s" % sys.version[:3], "config"))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   250
        elif platform == "darwin":
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   251
            machine = sysconfig_platform.split('-')[-1]
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   252
            if machine=='arm64' or os.environ.get('ARCHFLAGS','')=='-arch arm64':
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   253
                #print('!!!!! detected darwin arm64 build')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   254
                #probably an M1
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   255
                target = pjoin(
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   256
                            ensureResourceStuff('m1stuff.tar.gz','m1stuff','tar',
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   257
                                baseDir=os.environ.get('RL_CACHE_DIR','/tmp/reportlab')),
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   258
                            'm1stuff','opt','homebrew'
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   259
                            )
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   260
                _lib = pjoin(target,'lib')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   261
                _inc = pjoin(target,'include','freetype2')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   262
                #print('!!!!! target=%s' % target)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   263
                #print('!!!!! _lib=%s -->\n %s'%(_lib,listFiles(_lib,strJoin='\n ')))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   264
                #print('!!!!! _inc=%s -->\n %s'%(_inc,listFiles(_inc,strJoin='\n ')))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   265
                aDir(L, _lib)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   266
                aDir(I, _inc)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   267
                #print('!!!!! L=%s I=%s' % (L,I))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   268
            elif machine=='x86_64':
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   269
                aDir(L,'/usr/local/lib')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   270
                aDir(I, "/usr/local/include/freetype2")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   271
            # attempt to make sure we pick freetype2 over other versions
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   272
            aDir(I, "/sw/include/freetype2")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   273
            aDir(I, "/sw/lib/freetype2/include")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   274
            # fink installation directories
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   275
            aDir(L, "/sw/lib")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   276
            aDir(I, "/sw/include")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   277
            # darwin ports installation directories
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   278
            aDir(L, "/opt/local/lib")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   279
            aDir(I, "/opt/local/include")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   280
        aDir(I, "/usr/local/include")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   281
        aDir(L, "/usr/local/lib")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   282
        aDir(I, "/usr/include")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   283
        aDir(L, "/usr/lib")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   284
        aDir(I, "/usr/include/freetype2")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   285
        if addrSize==64:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   286
            aDir(L, "/usr/lib/lib64")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   287
            aDir(L, "/usr/lib/x86_64-linux-gnu")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   288
        else:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   289
            aDir(L, "/usr/lib/lib32")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   290
        prefix = sysconfig.get_config_var("prefix")
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   291
        if prefix:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   292
            aDir(L, pjoin(prefix, "lib"))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   293
            aDir(I, pjoin(prefix, "include"))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   294
        if libname:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   295
            gsn = ''.join((('lib' if not libname.startswith('lib') else ''),libname,'*'))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   296
            L = list(filter(lambda _: glob.glob(pjoin(_,gsn)),L))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   297
        for d in I:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   298
            mif = findFile(d,'ft2build.h')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   299
            if mif:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   300
                #print('!!!!! d=%s --> mif=%r' % (d,mif))
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   301
                break
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   302
        else:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   303
            mif = None
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   304
        if mif:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   305
            d = dirname(mif)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   306
            I = [dirname(d), d]
4736
17d4105e0c67 setup improvement from james Brown; require later rlPyCairo
robin
parents: 4724
diff changeset
   307
17d4105e0c67 setup improvement from james Brown; require later rlPyCairo
robin
parents: 4724
diff changeset
   308
            #fix for some RHEL systems from James Brown jbrown at easypost dot com
17d4105e0c67 setup improvement from james Brown; require later rlPyCairo
robin
parents: 4724
diff changeset
   309
            subdir = pjoin(d,'freetype2')
17d4105e0c67 setup improvement from james Brown; require later rlPyCairo
robin
parents: 4724
diff changeset
   310
            if isdir(subdir):
17d4105e0c67 setup improvement from james Brown; require later rlPyCairo
robin
parents: 4724
diff changeset
   311
                I.append(subdir)
17d4105e0c67 setup improvement from james Brown; require later rlPyCairo
robin
parents: 4724
diff changeset
   312
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   313
            ftv = freetypeVersion(findFile(d,'freetype.h'),'22')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   314
        else:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   315
            print('!!!!! cannot find ft2build.h')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   316
            sys.exit(1)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   317
        return ftv,I,L
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   318
inc_lib_dirs=inc_lib_dirs()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   319
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   320
def getVersionFromCCode(fn):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   321
    tag = re.search(r'^#define\s+VERSION\s+"([^"]*)"',open(fn,'r').read(),re.M)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   322
    return tag and tag.group(1) or ''
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   323
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   324
class _rl_dir_info:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   325
    def __init__(self,cn):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   326
        self.cn=cn
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   327
    def __call__(self,dir):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   328
        import stat
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   329
        fn = pjoin(dir,self.cn)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   330
        try:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   331
            return getVersionFromCCode(fn),os.stat(fn)[stat.ST_MTIME]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   332
        except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   333
            return None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   334
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   335
def _find_rl_ccode(dn='rl_accel',cn='_rl_accel.c'):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   336
    '''locate where the accelerator code lives'''
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   337
    _ = []
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   338
    for x in [
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   339
            pjoin('src','rl_addons',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   340
            pjoin('rl_addons',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   341
            pjoin('..','rl_addons',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   342
            pjoin('..','..','rl_addons',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   343
            dn,
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   344
            pjoin('..',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   345
            pjoin('..','..',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   346
            ] \
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   347
            + glob.glob(pjoin(dn+'-*',dn))\
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   348
            + glob.glob(pjoin('..',dn+'-*',dn))\
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   349
            + glob.glob(pjoin('..','..',dn+'-*',dn))\
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   350
            :
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   351
        fn = pjoin(pkgDir,x,cn)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   352
        if isfile(fn):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   353
            _.append(x)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   354
    if _:
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   355
        _ = list(filter(_rl_dir_info(cn),_))
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   356
        if len(_):
3818
6f3973d1e134 attempt to fix cmp-->key sorting
robin
parents: 3785
diff changeset
   357
            _.sort(key=_rl_dir_info)
4446
8fc52ebf1240 add MANIFEST.in; version --> 3.5.2
robin <robin@reportlab.com>
parents: 4439
diff changeset
   358
            _ = abspath(_[0])
8fc52ebf1240 add MANIFEST.in; version --> 3.5.2
robin <robin@reportlab.com>
parents: 4439
diff changeset
   359
            return _[_.index(os.sep.join(('','src','rl_addons')))+1:]
8fc52ebf1240 add MANIFEST.in; version --> 3.5.2
robin <robin@reportlab.com>
parents: 4439
diff changeset
   360
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   361
    return None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   362
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   363
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   364
def BIGENDIAN(macname,value=None):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   365
    'define a macro if bigendian'
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   366
    return sys.byteorder=='big' and [(macname,value)] or []
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   367
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   368
def pfxJoin(pfx,*N):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   369
    R=[]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   370
    for n in N:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   371
        R.append(os.path.join(pfx,n))
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   372
    return R
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   373
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   374
reportlab_files= [
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   375
        'fonts/00readme.txt',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   376
        'fonts/bitstream-vera-license.txt',
4446
8fc52ebf1240 add MANIFEST.in; version --> 3.5.2
robin <robin@reportlab.com>
parents: 4439
diff changeset
   377
        'fonts/DarkGarden-changelog.txt',
2977
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   378
        'fonts/DarkGarden-copying-gpl.txt',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   379
        'fonts/DarkGarden-copying.txt',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   380
        'fonts/DarkGarden-readme.txt',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   381
        'fonts/DarkGarden.sfd',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   382
        'fonts/DarkGardenMK.afm',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   383
        'fonts/DarkGardenMK.pfb',
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   384
        'fonts/Vera.ttf',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   385
        'fonts/VeraBd.ttf',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   386
        'fonts/VeraBI.ttf',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   387
        'fonts/VeraIt.ttf',
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   388
        'fonts/_abi____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   389
        'fonts/_ab_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   390
        'fonts/_ai_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   391
        'fonts/_a______.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   392
        'fonts/cobo____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   393
        'fonts/cob_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   394
        'fonts/com_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   395
        'fonts/coo_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   396
        'fonts/_ebi____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   397
        'fonts/_eb_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   398
        'fonts/_ei_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   399
        'fonts/_er_____.pfb',
3549
2c6e68e56e02 setup.py: use a versioned pfbfer.zip
rgbecker
parents: 3396
diff changeset
   400
        'fonts/sy______.pfb',
2c6e68e56e02 setup.py: use a versioned pfbfer.zip
rgbecker
parents: 3396
diff changeset
   401
        'fonts/zd______.pfb',
2c6e68e56e02 setup.py: use a versioned pfbfer.zip
rgbecker
parents: 3396
diff changeset
   402
        'fonts/zx______.pfb',
2c6e68e56e02 setup.py: use a versioned pfbfer.zip
rgbecker
parents: 3396
diff changeset
   403
        'fonts/zy______.pfb',
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   404
        'fonts/callig15.pfb',
4439
61ba11e7d143 another try at getting license.txt and callgi.afm into the pacjage :(
robin <robin@reportlab.com>
parents: 4438
diff changeset
   405
        'fonts/callig15.afm',
4446
8fc52ebf1240 add MANIFEST.in; version --> 3.5.2
robin <robin@reportlab.com>
parents: 4439
diff changeset
   406
        'reportlab/graphics/barcode/README'
8fc52ebf1240 add MANIFEST.in; version --> 3.5.2
robin <robin@reportlab.com>
parents: 4439
diff changeset
   407
        'reportlab/graphics/barcode/TODO'
4439
61ba11e7d143 another try at getting license.txt and callgi.afm into the pacjage :(
robin <robin@reportlab.com>
parents: 4438
diff changeset
   408
        'license.txt',
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   409
        ]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   410
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   411
def url2data(url,returnRaw=False):
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   412
    import urllib.request as ureq
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   413
    remotehandle = ureq.urlopen(url)
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   414
    try:
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   415
        raw = remotehandle.read()
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   416
        return raw if returnRaw else io.BytesIO(raw)
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   417
    finally:
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   418
        remotehandle.close()
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   419
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   420
def ensureResourceStuff(
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   421
                ftpName='winstuff.zip',
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   422
                buildName='winstuff',
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   423
                extract='zip',
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   424
                baseDir=pjoin(pkgDir,'build'),
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   425
                ):
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   426
    url='https://www.reportlab.com/ftp/%s' % ftpName
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   427
    target=pjoin(baseDir,buildName)
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   428
    done = pjoin(target,'.done')
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   429
    if not isfile(done):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   430
        if not isdir(target):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   431
            os.makedirs(target)
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   432
            if extract=='zip':
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   433
                import zipfile
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   434
                zipfile.ZipFile(url2data(url), 'r').extractall(path=target)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   435
            elif extract=='tar':
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   436
                import tarfile
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   437
                tarfile.open(fileobj=url2data(url), mode='r:gz').extractall(path=target)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   438
            import time
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   439
            with open(done,'w') as _:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   440
                _.write(time.strftime('%Y%m%dU%H%M%S\n',time.gmtime()))
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   441
    return target
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   442
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   443
def get_fonts(PACKAGE_DIR, reportlab_files):
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   444
    import zipfile
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   445
    rl_dir = PACKAGE_DIR['reportlab']
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   446
    if not [x for x in reportlab_files if not isfile(pjoin(rl_dir,x))]:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   447
        xitmsg = "Standard T1 font curves already downloaded"
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   448
    elif not dlt1:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   449
        xitmsg = "not downloading T1 font curve files"
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   450
    else:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   451
        try:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   452
            infoline("Downloading standard T1 font curves")
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   453
            zipdata = url2data("http://www.reportlab.com/ftp/pfbfer-20180109.zip")
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   454
            archive = zipfile.ZipFile(zipdata)
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   455
            dst = pjoin(rl_dir, 'fonts')
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   456
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   457
            for name in archive.namelist():
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   458
                if not name.endswith('/'):
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   459
                    with open(pjoin(dst, name), 'wb') as outfile:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   460
                        outfile.write(archive.read(name))
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   461
            xitmsg = "Finished download of standard T1 font curves"
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   462
        except:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   463
            xitmsg = "Failed to download standard T1 font curves"
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   464
    infoline(xitmsg)
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   465
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   466
def get_glyphlist_module(PACKAGE_DIR):
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   467
    try:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   468
        lfn = pjoin("pdfbase","_glyphlist.py")
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   469
        fn = pjoin(PACKAGE_DIR['reportlab'],lfn)
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   470
        if isfile(fn):
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   471
            xitmsg = "The _glyphlist module already exists"
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   472
        else:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   473
            text = url2data("https://raw.githubusercontent.com/adobe-type-tools/agl-aglfn/master/glyphlist.txt",True)
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   474
            comments = ['#see https://github.com/adobe-type-tools/agl-aglfn\n'].append
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   475
            G2U = [].append
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   476
            G2Us = [].append
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   477
            if not isinstance(text,str):
4378
5ffdb38b54ef fix setup.py for py33
robin
parents: 4377
diff changeset
   478
                text = text.decode('latin1')
5ffdb38b54ef fix setup.py for py33
robin
parents: 4377
diff changeset
   479
            for line in text.split('\n'):
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   480
                line = line.strip()
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   481
                if not line: continue
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   482
                if line.startswith('#'):
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   483
                    comments(line+'\n')
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   484
                else:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   485
                    gu = line.split(';')
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   486
                    if len(gu)==2:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   487
                        v = gu[1].split()
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   488
                        if len(v)==1:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   489
                            G2U('\t%r: 0x%s,\n' % (gu[0],gu[1]))
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   490
                        else:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   491
                            G2Us('\t%r: (%s),\n' % (gu[0],','.join('0x%s'%u for u in v)))
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   492
                    else:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   493
                        infoline('bad glyphlist line %r' % line, '!!!!!')
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   494
            with open(fn,'w') as f:
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   495
                f.write(''.join(comments.__self__))
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   496
                f.write('_glyphname2unicode = {\n')
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   497
                f.write(''.join(G2U.__self__))
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   498
                f.write('\t}\n')
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   499
                f.write('_glyphname2unicodes = {\n')
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   500
                f.write(''.join(G2Us.__self__))
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   501
                f.write('\t}\n')
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   502
            xitmsg = "Finished creation of _glyphlist.py"
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   503
    except:
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   504
        xitmsg = "Failed to download glyphlist.txt"
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   505
    infoline(xitmsg)
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   506
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   507
def canImport(pkg):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   508
    ns = [pkg.find(_) for _ in '<>=' if _ in pkg]
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   509
    if ns: pkg =pkg[:min(ns)]
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   510
    ns = {}
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   511
    try:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   512
        exec('import %s as M' % pkg,{},ns)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   513
    except:
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
   514
        if verbose>=2:
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
   515
            showTraceback("can't import %s" % pkg)
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   516
    return 'M' in ns
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   517
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   518
def pipInstall(pkg, ixu=None):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   519
    if canImport(pkg): return True
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   520
    i = ['-i%s' % ixu] if ixu else []
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
   521
    r = spCall([sys.executable, '-mpip', 'install']+i+[pkg],dropOutput=verbose<3)
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   522
    return canImport(pkg)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   523
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   524
def pipUninstall(pkg):
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
   525
    spCall((sys.executable,'-mpip','-q','uninstall','-y', pkg), dropOutput=verbose<3)
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   526
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   527
def pipInstallGroups(pkgs, ixu=None):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   528
    '''install groups of packages; if any of a group fail we backout the group'''
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   529
    for g in pkgs:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   530
        I = []  #thse are the installed in this group
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   531
        for pkg in g.split():
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   532
            if pipInstall(pkg,ixu):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   533
                I.append(pkg)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   534
            else:
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
   535
                print('!!!!! pip uninstalled %s' % repr(I)) 
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   536
                for pkg in I:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   537
                    pipUninstall(pkg)
4679
50b5ba349fd0 try to fix test command; print installed groups
robin
parents: 4678
diff changeset
   538
                I = []
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   539
                break
4679
50b5ba349fd0 try to fix test command; print installed groups
robin
parents: 4678
diff changeset
   540
        if I:
4680
de72e4465af8 fix syntax error; stupidly introduced by robin grrrhhhh!
robin
parents: 4679
diff changeset
   541
            print('===== pip installed %s' % repr(I)) 
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   542
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   543
def vopt(opt):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   544
    opt = '--%s=' % opt
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   545
    v = [_ for _ in sys.argv if _.startswith(opt)]
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   546
    for _ in v: sys.argv.remove(_)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   547
    n = len(opt)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   548
    return list(filter(None,[_[n:] for _ in v]))
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   549
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   550
class QUPStr(str):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   551
    def __new__(cls,s,u,p):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   552
        self = str.__new__(cls,s)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   553
        self.u = u
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   554
        self.p = p
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   555
        return self
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   556
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   557
def qup(url, pat=re.compile(r'(?P<scheme>https?://)(?P<up>[^@]*)(?P<rest>@.*)$')):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   558
    '''urlquote the user name and password'''
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   559
    m = pat.match(url)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   560
    if m:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   561
        u, p = m.group('up').split(':',1)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   562
        url = "%s%s:%s%s" % (m.group('scheme'),urlquote(u),urlquote(p),m.group('rest'))
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   563
    else:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   564
        u = p = ''
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   565
    return QUPStr(url,u,p)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   566
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   567
def performPipInstalls():
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   568
    pip_installs = vopt('pip-install')
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   569
    pipInstallGroups(pip_installs)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   570
    rl_pip_installs = vopt('rl-pip-install')
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   571
    if rl_pip_installs:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   572
        rl_ixu = vopt('rl-index-url')
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   573
        if len(rl_ixu)==1:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   574
            pipInstallGroups(rl_pip_installs,qup(rl_ixu[0]))
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   575
        else:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   576
            raise ValueError('rl-pip-install requires exactly 1 --rl-index-url not %d' % len(rl_ixu))
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   577
4678
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   578
def showEnv():
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   579
    action = -1 if specialOption('--show-env-only') else 1 if specialOption('--show-env') else 0
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   580
    if not action: return
4678
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   581
    print('+++++ setup.py environment')
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   582
    print('+++++ sys.version = %s' % sys.version.replace('\n',''))
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   583
    import platform
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   584
    for k in sorted((_ for _ in dir(platform) if not _.startswith('_'))):
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   585
        try:
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   586
            v = getattr(platform,k)
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   587
            if isinstance(v,(str,list,tuple,bool)):
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   588
                v = repr(v)
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   589
            if callable(v) and v.__module__=='platform':
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   590
                v = repr(v())
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   591
            else:
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   592
                continue
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   593
        except:
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   594
            v = '?????'
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   595
        print('+++++ platform.%s = %s' % (k,v))
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   596
    print('--------------------------')
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   597
    for k, v in sorted(os.environ.items()):
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   598
        print('+++++ environ[%s] = %r' % (k,v))
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   599
    print('--------------------------')
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   600
    if action<0:
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   601
        sys.exit(0)
4678
4b90e6c7fe0b added setup.py --show-env option; reverted and hacked buildwheels.yml
robin
parents: 4672
diff changeset
   602
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   603
def main():
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   604
    showEnv()
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   605
    performPipInstalls()
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   606
    #test to see if we've a special command
4665
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
   607
    if 'test' in sys.argv \
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
   608
        or 'tests' in sys.argv \
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
   609
        or 'tests-postinstall' in sys.argv \
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
   610
        or 'tests-preinstall' in sys.argv:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   611
        verboseTests = specialOption('--verbose-tests')
4745
bbe50343dd16 start branch 3.6.13; tables.py error improvements and test exclusions
robin
parents: 4742
diff changeset
   612
        excludes = [_ for _ in sys.argv if _.startswith('--exclude=')]
bbe50343dd16 start branch 3.6.13; tables.py error improvements and test exclusions
robin
parents: 4742
diff changeset
   613
        for _ in excludes:
bbe50343dd16 start branch 3.6.13; tables.py error improvements and test exclusions
robin
parents: 4742
diff changeset
   614
            sys.argv.remove(_)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   615
        if len(sys.argv)!=2:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   616
            raise ValueError('tests commands may only be used alone sys.argv[1:]=%s' % repr(sys.argv[1:]))
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   617
        cmd = sys.argv[-1]
4366
ddf3d4f5066a add a setup.py test command to aid CI
robin <robin@reportlab.com>
parents: 4359
diff changeset
   618
        PYTHONPATH = [pkgDir] if cmd!='test' else []
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   619
        if cmd=='tests-preinstall':
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   620
            PYTHONPATH.insert(0,pjoin(pkgDir,'src'))
4366
ddf3d4f5066a add a setup.py test command to aid CI
robin <robin@reportlab.com>
parents: 4359
diff changeset
   621
        if PYTHONPATH: os.environ['PYTHONPATH']=os.pathsep.join(PYTHONPATH)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   622
        os.chdir(pjoin(pkgDir,'tests'))
4745
bbe50343dd16 start branch 3.6.13; tables.py error improvements and test exclusions
robin
parents: 4742
diff changeset
   623
        cli = [sys.executable, 'runAll.py']+excludes
4665
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
   624
        if cmd=='tests-postinstall':
351eb268ca66 changes in setup.py runAll.py; version --> 3.5.68
robin
parents: 4649
diff changeset
   625
            cli.append('--post-install')
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   626
        if verboseTests:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   627
            cli.append('--verbosity=2')
4681
1f01c9c1391e try to merge buildwheels tests stdout/err
robin
parents: 4680
diff changeset
   628
        r = spCall(cli)
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   629
        sys.exit(('!!!!! runAll.py --> %s should exit with error !!!!!' % r) if r else r)
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   630
    elif 'null-cmd' in sys.argv or 'null-command' in sys.argv:
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   631
        sys.exit(0)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   632
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   633
    debug_compile_args = []
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   634
    debug_link_args = []
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   635
    debug_macros = []
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   636
    debug = int(os.environ.get('RL_DEBUG','0'))
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   637
    if debug:
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   638
        if sys.platform == 'win32':
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   639
            debug_compile_args=['/Zi']
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   640
            debug_link_args=['/DEBUG']
4636
7909f0402321 python support fixes thanks to Jon Ribben
robin
parents: 4622
diff changeset
   641
        if debug>1:
7909f0402321 python support fixes thanks to Jon Ribben
robin
parents: 4622
diff changeset
   642
            debug_macros.extend([('RL_DEBUG',debug), ('ROBIN_DEBUG',None)])
4605
f8bb8ca3861d version --> 3.5.50
robin
parents: 4601
diff changeset
   643
    if mdbg:
f8bb8ca3861d version --> 3.5.50
robin
parents: 4601
diff changeset
   644
        debug_macros.extend([('MEMORY_DEBUG',None)])
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   645
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   646
    SPECIAL_PACKAGE_DATA = {}
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   647
    RL_ACCEL = _find_rl_ccode('rl_accel','_rl_accel.c')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   648
    LIBRARIES=[]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   649
    EXT_MODULES = []
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   650
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   651
    if not RL_ACCEL:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   652
        infoline( '===================================================')
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   653
        infoline( 'not attempting build of the _rl_accel extension')
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   654
        infoline( '===================================================')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   655
    else:
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   656
        infoline( '================================================')
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   657
        infoline( 'Attempting build of _rl_accel')
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   658
        infoline( 'extensions from %r'%RL_ACCEL)
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   659
        infoline( '================================================')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   660
        EXT_MODULES += [
3727
67e69a84138b changes to bring into line with new Python 3.3.0 universe
robin
parents: 3724
diff changeset
   661
                    Extension( 'reportlab.lib._rl_accel',
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   662
                                [pjoin(RL_ACCEL,'_rl_accel.c')],
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   663
                                include_dirs=[],
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   664
                            define_macros=[]+debug_macros,
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   665
                            library_dirs=[],
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   666
                            libraries=[], # libraries to link against
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   667
                            extra_compile_args=debug_compile_args,
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   668
                            extra_link_args=debug_link_args,
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   669
                            ),
3733
e31cab3e5146 temporarily remove some extensions
robin
parents: 3727
diff changeset
   670
                        ]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   671
    RENDERPM = _find_rl_ccode('renderPM','_renderPM.c')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   672
    if not RENDERPM:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   673
        infoline( '===================================================')
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   674
        infoline( 'not attempting build of _renderPM')
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   675
        infoline( '===================================================')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   676
    else:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   677
        infoline( '===================================================')
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   678
        infoline( 'Attempting build of _renderPM')
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   679
        infoline( 'extensions from %r'%RENDERPM)
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   680
        infoline( '===================================================')
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   681
        GT1_DIR=pjoin(RENDERPM,'gt1')
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   682
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   683
        if not usla:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   684
            LIBART_INC=None #don't use system libart
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   685
        else:
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   686
            #check for an installed libart
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   687
            LIBART_INC = list(sorted(glob.glob('/usr/include/libart-*/libart_lgpl/libart-features.h')))
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   688
        if LIBART_INC:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   689
            def installed_libart_version(fn):
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   690
                for l in open(fn, 'r').readlines():
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   691
                    if l.startswith('#define LIBART_VERSION'):
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   692
                        v = l[:-1].split(' ')[-1]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   693
                        return v
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   694
                return '"0.0.0"'
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   695
            LIBART_INC = LIBART_INC[-1]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   696
            LIBART_VERSION = installed_libart_version(LIBART_INC)
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   697
            LIBART_INC = os.path.dirname(LIBART_INC)
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   698
            LIBART_SOURCES=[]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   699
            LIBART_LIB = ['art_lgpl_2']
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   700
            infoline('will use installed libart %s' % LIBART_VERSION.replace('"',''))
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   701
        else:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   702
            LIBART_DIR = LIBART_INC = pjoin(RENDERPM,'libart_lgpl')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   703
            LIBART_LIB = []
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   704
            make_libart_config(LIBART_DIR)
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   705
            LIBART_SOURCES=[
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   706
                    pjoin(LIBART_DIR,'art_vpath_bpath.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   707
                    pjoin(LIBART_DIR,'art_rgb_pixbuf_affine.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   708
                    pjoin(LIBART_DIR,'art_rgb_svp.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   709
                    pjoin(LIBART_DIR,'art_svp.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   710
                    pjoin(LIBART_DIR,'art_svp_vpath.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   711
                    pjoin(LIBART_DIR,'art_svp_vpath_stroke.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   712
                    pjoin(LIBART_DIR,'art_svp_ops.c'),
4306
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4303
diff changeset
   713
                    pjoin(LIBART_DIR,'art_svp_wind.c'),
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   714
                    pjoin(LIBART_DIR,'art_vpath.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   715
                    pjoin(LIBART_DIR,'art_vpath_dash.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   716
                    pjoin(LIBART_DIR,'art_affine.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   717
                    pjoin(LIBART_DIR,'art_rect.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   718
                    pjoin(LIBART_DIR,'art_rgb_affine.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   719
                    pjoin(LIBART_DIR,'art_rgb_affine_private.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   720
                    pjoin(LIBART_DIR,'art_rgb.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   721
                    pjoin(LIBART_DIR,'art_rgb_rgba_affine.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   722
                    pjoin(LIBART_DIR,'art_svp_intersect.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   723
                    pjoin(LIBART_DIR,'art_svp_render_aa.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   724
                    pjoin(LIBART_DIR,'art_misc.c'),
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   725
                    ]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   726
            def libart_version():
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   727
                pat0 = re.compile(r'^\s*LIBART_(MAJOR|MINOR|MICRO)_VERSION\s*=\s*(\d+)')
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   728
                pat1 = re.compile(r'^\s*m4_define\s*\(\s*\[\s*libart_(major|minor|micro)_version\s*\]\s*,\s*\[(\d+)\]\s*\)')
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   729
                def check_match(l):
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   730
                    for p in (pat0, pat1):
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   731
                        m = p.match(l)
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   732
                        if m: return m
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   733
                K = ('major','minor','micro')
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   734
                D = {}
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   735
                for l in open(pjoin(LIBART_DIR,'configure.in'),'r').readlines():
4449
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   736
                    m = check_match(l)
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   737
                    if m:
60efe7cfba55 make local libart the default
robin <robin@reportlab.com>
parents: 4446
diff changeset
   738
                        D[m.group(1).lower()] = m.group(2)
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   739
                        if len(D)==3: break
4601
f3e622b58a0c use a STRINGIFY macro in _renderPM.c; remove excess quotes in setup.py
robin
parents: 4597
diff changeset
   740
                return '.'.join(map(lambda k,D=D: D.get(k,'?'),K))
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   741
            LIBART_VERSION = libart_version()
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   742
            infoline('will use package libart %s' % LIBART_VERSION.replace('"',''))
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   743
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   744
        SOURCES=[pjoin(RENDERPM,'_renderPM.c'),
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   745
                    pjoin(GT1_DIR,'gt1-parset1.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   746
                    pjoin(GT1_DIR,'gt1-dict.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   747
                    pjoin(GT1_DIR,'gt1-namecontext.c'),
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   748
                    pjoin(GT1_DIR,'gt1-region.c'),
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   749
                    ]+LIBART_SOURCES
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   750
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   751
        if platform=='win32':
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   752
            target = ensureResourceStuff()
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   753
            FT_LIB = pjoin(target,'libs','amd64' if addrSize==64 else 'x86','freetype.lib')
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   754
            if not isfile(FT_LIB):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   755
                infoline('freetype lib %r not found' % FT_LIB, pfx='!!!!')
3301
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   756
                FT_LIB=[]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   757
            if FT_LIB:
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   758
                FT_INC_DIR = pjoin(target,'include')
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   759
                if not isfile(pjoin(FT_INC_DIR,'ft2build.h')):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   760
                    FT_INC_DIR = pjoin(FT_INC_DIR,'freetype2')
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   761
                    if not isfile(pjoin(FT_INC_DIR,'ft2build.h')):
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   762
                        infoline('freetype2 include folder %r not found' % FT_INC_DIR, pfx='!!!!!')
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   763
                        FT_LIB=FT_LIB_DIR=FT_INC_DIR=FT_MACROS=[]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   764
                FT_MACROS = [('RENDERPM_FT',None)]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   765
                FT_LIB_DIR = [dirname(FT_LIB)]
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   766
                FT_INC_DIR = [FT_INC_DIR]
3352
753cbc1ed53f setup.py: allow win32 FT libs to come from the environment
rgbecker
parents: 3328
diff changeset
   767
                FT_LIB_PATH = FT_LIB
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   768
                FT_LIB = [splitext(basename(FT_LIB))[0]]
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   769
                if isdir(FT_INC_DIR[0]):
4668
f8d6dc8f07fc remove support for 2.7; require >=3.6; version-->3.6.0
robin
parents: 4665
diff changeset
   770
                    infoline('installing with freetype %r' % FT_LIB_PATH)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   771
            else:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   772
                FT_LIB=FT_LIB_DIR=FT_INC_DIR=FT_MACROS=[]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   773
        else:
4715
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   774
            ftv, I, L = inc_lib_dirs('freetype')
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   775
            FT_LIB=['freetype']
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   776
            FT_LIB_DIR=L
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   777
            FT_INC_DIR=I
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   778
            FT_MACROS = [('RENDERPM_FT',None)]
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   779
            infoline('installing with freetype version %s' % ftv)
82c17d17a683 _rl_accel.c (0.81) has better errors; support M1 builds; version-->3.6.9
robin
parents: 4710
diff changeset
   780
            infoline('FT_LIB_DIR=%r FT_INC_DIR=%r' % (FT_LIB_DIR,FT_INC_DIR))
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   781
        if not FT_LIB:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   782
            infoline('# installing without freetype no ttf, sorry!')
3301
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   783
            infoline('# You need to install a static library version of the freetype2 software')
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   784
            infoline('# If you need truetype support in renderPM')
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   785
            infoline('# You may need to edit setup.cfg (win32)')
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   786
            infoline('# or edit this file to access the library if it is installed')
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   787
3727
67e69a84138b changes to bring into line with new Python 3.3.0 universe
robin
parents: 3724
diff changeset
   788
        EXT_MODULES +=  [Extension( 'reportlab.graphics._renderPM',
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   789
                                        SOURCES,
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   790
                                        include_dirs=[RENDERPM,LIBART_INC,GT1_DIR]+FT_INC_DIR,
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   791
                                        define_macros=FT_MACROS+[('LIBART_COMPILATION',None)]+debug_macros+[('LIBART_VERSION',LIBART_VERSION)],
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   792
                                        library_dirs=[]+FT_LIB_DIR,
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   793
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   794
                                        # libraries to link against
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   795
                                        libraries=FT_LIB+LIBART_LIB,
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   796
                                        extra_compile_args=debug_compile_args,
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   797
                                        extra_link_args=debug_link_args,
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   798
                                        ),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   799
                            ]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   800
        infoline('################################################')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   801
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   802
    #copy some special case files into place so package_data will treat them properly
4157
dc2894478c0d setup.py: fix for pip -e proposed by Marius Gedminas
robin
parents: 4142
diff changeset
   803
    PACKAGE_DIR = {'':'src','reportlab': pjoin('src','reportlab')}
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   804
    for fn,dst in SPECIAL_PACKAGE_DATA.items():
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   805
        shutil.copyfile(fn,pjoin(PACKAGE_DIR['reportlab'],dst))
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   806
        reportlab_files.append(dst)
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   807
    get_fonts(PACKAGE_DIR, reportlab_files)
4377
da36c2d6e2d2 fix embedded font & fontfinder bugs reported by htgoebel @ bitbucket; version --> 3.4.23
robin <robin@reportlab.com>
parents: 4366
diff changeset
   808
    get_glyphlist_module(PACKAGE_DIR)
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   809
    try:
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   810
        setup(
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   811
            name="reportlab",
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   812
            version=get_version(),
4437
807c061d28f2 add license.txt to setup.py
robin <robin@reportlab.com>
parents: 4409
diff changeset
   813
            license="BSD license (see license.txt for details), Copyright (c) 2000-2018, ReportLab Inc.",
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   814
            description="The Reportlab Toolkit",
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   815
            long_description="""The ReportLab Toolkit. An Open Source Python library for generating PDFs and graphics.""",
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   816
3303
c755d7c0d53d author list and contact details updated
meitham
parents: 3301
diff changeset
   817
            author="Andy Robinson, Robin Becker, the ReportLab team and the community",
c755d7c0d53d author list and contact details updated
meitham
parents: 3301
diff changeset
   818
            author_email="reportlab-users@lists2.reportlab.com",
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   819
            url="http://www.reportlab.com/",
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   820
            packages=[
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   821
                    'reportlab',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   822
                    'reportlab.graphics.charts',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   823
                    'reportlab.graphics.samples',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   824
                    'reportlab.graphics.widgets',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   825
                    'reportlab.graphics.barcode',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   826
                    'reportlab.graphics',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   827
                    'reportlab.lib',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   828
                    'reportlab.pdfbase',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   829
                    'reportlab.pdfgen',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   830
                    'reportlab.platypus',
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   831
                    ],
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   832
            package_dir = PACKAGE_DIR,
4439
61ba11e7d143 another try at getting license.txt and callgi.afm into the pacjage :(
robin <robin@reportlab.com>
parents: 4438
diff changeset
   833
            package_data = {'reportlab': reportlab_files},
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   834
            ext_modules =   EXT_MODULES,
4225
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   835
            classifiers = [
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   836
                'Development Status :: 5 - Production/Stable',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   837
                'Intended Audience :: Developers',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   838
                'License :: OSI Approved :: BSD License',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   839
                'Topic :: Printing',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   840
                'Topic :: Text Processing :: Markup',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   841
                'Programming Language :: Python :: 3',
4518
1518bd5f69f9 ttf recursive search; version-->3.5.25
robin
parents: 4449
diff changeset
   842
                'Programming Language :: Python :: 3.7',
1518bd5f69f9 ttf recursive search; version-->3.5.25
robin
parents: 4449
diff changeset
   843
                'Programming Language :: Python :: 3.8',
4622
0d3835d23cdc allow Drawing.outDir to be a callable; version --> 3.5.56
robin
parents: 4605
diff changeset
   844
                'Programming Language :: Python :: 3.9',
4672
558e357ccfd3 python3 only in setup, bump workflow builds; version--> 3.6.2
robin
parents: 4668
diff changeset
   845
                'Programming Language :: Python :: 3.10',
4692
ace945128507 changes to allow for python 3.11; version --> 3.6.5
robin
parents: 4685
diff changeset
   846
                'Programming Language :: Python :: 3.11',
4226
10f62c8dd584 add comma
robin
parents: 4225
diff changeset
   847
                ],
4061
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
   848
            
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
   849
            #this probably only works for setuptools, but distutils seems to ignore it
4724
94016d4f9dcc require pillow>=9.0.0; patch contributed by Claude Paroz claude at 2xlibre.net
robin
parents: 4718
diff changeset
   850
            install_requires=['pillow>=9.0.0'],
4742
dbdba710a163 fix date version==3.6.12
robin
parents: 4736
diff changeset
   851
            python_requires='>=3.7,<4',
4645
a84b1da94fad allow renderPM to have an rlPyCairo as a backend; version-->3.5.61
robin
parents: 4636
diff changeset
   852
            extras_require={
4742
dbdba710a163 fix date version==3.6.12
robin
parents: 4736
diff changeset
   853
                'RLPYCAIRO': ['rlPyCairo>=0.1.0'],          #for using cairo as renderPM backend
dbdba710a163 fix date version==3.6.12
robin
parents: 4736
diff changeset
   854
                'FTTEXTPATH': ['freetype-py>=2.3.0,<2.4'],  #for using freetype text paths
4645
a84b1da94fad allow renderPM to have an rlPyCairo as a backend; version-->3.5.61
robin
parents: 4636
diff changeset
   855
                },
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   856
            )
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   857
        print()
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   858
        print('########## SUMMARY INFO #########')
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   859
        print('\n'.join(INFOLINES))
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   860
    finally:
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   861
        for dst in SPECIAL_PACKAGE_DATA.values():
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   862
            os.remove(pjoin(PACKAGE_DIR['reportlab'],dst))
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   863
            reportlab_files.remove(dst)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   864
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   865
if __name__=='__main__':
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   866
    main()