setup.py
author robin <robin@reportlab.com>
Tue, 07 Mar 2017 10:00:34 +0000
changeset 4330 617ffa6bbdc8
parent 4314 27d3ed39ad3e
child 4359 0fbf25e48574
permissions -rw-r--r--
changes for release 3.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
     1
#Copyright ReportLab Europe Ltd. 2000-2017
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
     2
#see license.txt for license details
4314
27d3ed39ad3e support Image with drawing instance image; version-->3.3.30
robin <robin@reportlab.com>
parents: 4308
diff changeset
     3
__version__='3.3.30'
3752
b26975887acc fix improt of configparser
robin
parents: 3733
diff changeset
     4
import os, sys, glob, shutil
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
     5
def specialOption(n):
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
     6
    v = False
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
     7
    while n in sys.argv:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
     8
        v = True
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
     9
        sys.argv.remove(n)
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    10
    return v
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    11
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    12
#defaults for these options may be configured in local-setup.cfg
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    13
#[OPTIONS]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    14
#no-download-t1-files=yes
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    15
#ignore-system-libart=yes
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    16
# if used on command line the config values are not used
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    17
dlt1 = not specialOption('--no-download-t1-files')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    18
isla = specialOption('--ignore-system-libart')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    19
3752
b26975887acc fix improt of configparser
robin
parents: 3733
diff changeset
    20
try:
b26975887acc fix improt of configparser
robin
parents: 3733
diff changeset
    21
    import configparser
b26975887acc fix improt of configparser
robin
parents: 3733
diff changeset
    22
except ImportError:
b26975887acc fix improt of configparser
robin
parents: 3733
diff changeset
    23
    import ConfigParser as configparser
3785
974819935ede setup.py: fix python3 badness
robin
parents: 3764
diff changeset
    24
isPy3 = sys.version_info[0]==3
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    25
platform = sys.platform
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    26
pjoin = os.path.join
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    27
abspath = os.path.abspath
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    28
isfile = os.path.isfile
3394
af8adfc5b9c9 setup.py: fix isdir misdefinition
rgbecker
parents: 3352
diff changeset
    29
isdir = os.path.isdir
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    30
dirname = os.path.dirname
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    31
if __name__=='__main__':
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    32
    pkgDir=dirname(sys.argv[0])
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    33
else:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    34
    pkgDir=dirname(__file__)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    35
if not pkgDir:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    36
    pkgDir=os.getcwd()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    37
elif not os.path.isabs(pkgDir):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    38
    pkgDir=os.path.abspath(pkgDir)
3168
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    39
try:
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    40
    os.chdir(pkgDir)
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    41
except:
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
    42
    print('!!!!! warning could not change directory to %r' % pkgDir)
4060
05188cfb93b2 setup.py: start using setuptools
robin
parents: 3974
diff changeset
    43
daily=int(os.environ.get('RL_EXE_DAILY','0'))
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    44
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    45
import distutils
4061
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
    46
try:
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
    47
    from setuptools import setup, Extension
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
    48
except ImportError:
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
    49
    from distutils.core import setup, Extension
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    50
from distutils import sysconfig
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    51
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    52
# from Zope - App.Common.package_home
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    53
def package_home(globals_dict):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    54
    __name__=globals_dict['__name__']
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    55
    m=sys.modules[__name__]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    56
    r=os.path.split(m.__path__[0])[0]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    57
    return r
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    58
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    59
package_path = pjoin(package_home(distutils.__dict__), 'site-packages', 'reportlab')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    60
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    61
def get_version():
3033
0c9602603837 setup.py: allow for daily builds having different version string
rgbecker
parents: 3028
diff changeset
    62
    if daily: return 'daily'
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    63
    #determine Version
3168
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    64
    HERE = pkgDir
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    65
    if os.getcwd()!=HERE:
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    66
        if __name__=='__main__':
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    67
            HERE=os.path.dirname(sys.argv[0])
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    68
        else:
cd1797023f60 setup.py: attempt to make more robust against running away from pkgDir
rgbecker
parents: 3106
diff changeset
    69
            HERE=os.path.dirname(__file__)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    70
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    71
    #first try source
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    72
    FN = pjoin(HERE,'src','reportlab','__init__')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    73
    try:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    74
        for l in open(pjoin(FN+'.py'),'r').readlines():
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    75
            if l.startswith('Version'):
3724
8c3d733474a0 added fixed setup.py for Python-3.3
rptlab
parents: 3721
diff changeset
    76
                D = {}
8c3d733474a0 added fixed setup.py for Python-3.3
rptlab
parents: 3721
diff changeset
    77
                exec(l.strip(),D)
8c3d733474a0 added fixed setup.py for Python-3.3
rptlab
parents: 3721
diff changeset
    78
                return D['Version']
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    79
    except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    80
        pass
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    81
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    82
    #don't have source, try import
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    83
    import imp
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    84
    for desc in ('.pyc', 'rb', 2), ('.pyo', 'rb', 2):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    85
        try:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    86
            fn = FN+desc[0]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    87
            f = open(fn,desc[1])
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    88
            m = imp.load_module('reportlab',f,fn,desc)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    89
            return m.Version
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    90
        except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    91
            pass
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    92
    raise ValueError('Cannot determine ReportLab Version')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    93
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    94
class config:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    95
    def __init__(self):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
    96
        try:
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
    97
            self.parser = configparser.RawConfigParser()
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
    98
            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
    99
        except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   100
            self.parser = None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   101
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   102
    def __call__(self,sect,name,default=None):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   103
        try:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   104
            return self.parser.get(sect,name)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   105
        except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   106
            return default
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   107
config = config()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   108
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   109
if dlt1:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   110
    #not set on command line so try for config value
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   111
    dlt1 = not config('OPTIONS','no-download-t1-files','0').lower() in ('1','true','yes')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   112
if not isla:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   113
    #not set on command line so try for config value
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   114
    isla = config('OPTIONS','ignore-system-libart','0').lower() in ('1','true','yes')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   115
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   116
#this code from /FBot's PIL setup.py
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   117
def aDir(P, d, x=None):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   118
    if d and os.path.isdir(d) and d not in P:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   119
        if x is None:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   120
            P.append(d)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   121
        else:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   122
            P.insert(x, d)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   123
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   124
class inc_lib_dirs:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   125
    L = None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   126
    I = None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   127
    def __call__(self):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   128
        if self.L is None:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   129
            L = []
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   130
            I = []
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   131
            if platform == "cygwin":
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   132
                aDir(L, os.path.join("/usr/lib", "python%s" % sys.version[:3], "config"))
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   133
            elif platform == "darwin":
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   134
                # attempt to make sure we pick freetype2 over other versions
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   135
                aDir(I, "/sw/include/freetype2")
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   136
                aDir(I, "/sw/lib/freetype2/include")
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   137
                # fink installation directories
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   138
                aDir(L, "/sw/lib")
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   139
                aDir(I, "/sw/include")
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   140
                # darwin ports installation directories
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   141
                aDir(L, "/opt/local/lib")
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   142
                aDir(I, "/opt/local/include")
3001
79fd411ced33 setup.py: fix include paths
rgbecker
parents: 2982
diff changeset
   143
            aDir(I, "/usr/local/include")
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   144
            aDir(L, "/usr/local/lib")
3102
b3a493c2fb1c setup.py: add extra lookups for Red Hat
rgbecker
parents: 3033
diff changeset
   145
            aDir(I, "/usr/include")
b3a493c2fb1c setup.py: add extra lookups for Red Hat
rgbecker
parents: 3033
diff changeset
   146
            aDir(L, "/usr/lib")
b3a493c2fb1c setup.py: add extra lookups for Red Hat
rgbecker
parents: 3033
diff changeset
   147
            aDir(I, "/usr/include/freetype2")
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   148
            prefix = sysconfig.get_config_var("prefix")
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   149
            if prefix:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   150
                aDir(L, pjoin(prefix, "lib"))
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   151
                aDir(I, pjoin(prefix, "include"))
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   152
            self.L=L
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   153
            self.I=I
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   154
        return self.I,self.L
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   155
inc_lib_dirs=inc_lib_dirs()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   156
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   157
def getVersionFromCCode(fn):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   158
    import re
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   159
    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
   160
    return tag and tag.group(1) or ''
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   161
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   162
class _rl_dir_info:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   163
    def __init__(self,cn):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   164
        self.cn=cn
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   165
    def __call__(self,dir):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   166
        import stat
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   167
        fn = pjoin(dir,self.cn)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   168
        try:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   169
            return getVersionFromCCode(fn),os.stat(fn)[stat.ST_MTIME]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   170
        except:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   171
            return None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   172
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   173
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
   174
    '''locate where the accelerator code lives'''
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   175
    _ = []
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   176
    for x in [
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   177
            pjoin('src','rl_addons',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   178
            pjoin('rl_addons',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   179
            pjoin('..','rl_addons',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   180
            pjoin('..','..','rl_addons',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   181
            dn,
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   182
            pjoin('..',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   183
            pjoin('..','..',dn),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   184
            ] \
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   185
            + glob.glob(pjoin(dn+'-*',dn))\
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   186
            + glob.glob(pjoin('..',dn+'-*',dn))\
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   187
            + glob.glob(pjoin('..','..',dn+'-*',dn))\
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   188
            :
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   189
        fn = pjoin(pkgDir,x,cn)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   190
        if isfile(fn):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   191
            _.append(x)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   192
    if _:
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   193
        _ = list(filter(_rl_dir_info(cn),_))
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   194
        if len(_):
3818
6f3973d1e134 attempt to fix cmp-->key sorting
robin
parents: 3785
diff changeset
   195
            _.sort(key=_rl_dir_info)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   196
            return abspath(_[0])
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   197
    return None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   198
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   199
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   200
def BIGENDIAN(macname,value=None):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   201
    'define a macro if bigendian'
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   202
    return sys.byteorder=='big' and [(macname,value)] or []
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   203
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   204
def pfxJoin(pfx,*N):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   205
    R=[]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   206
    for n in N:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   207
        R.append(os.path.join(pfx,n))
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   208
    return R
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   209
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   210
INFOLINES=[]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   211
def infoline(t):
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   212
    print(t)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   213
    INFOLINES.append(t)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   214
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   215
reportlab_files= [
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   216
        'fonts/00readme.txt',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   217
        'fonts/bitstream-vera-license.txt',
2977
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   218
        'fonts/DarkGarden-copying-gpl.txt',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   219
        'fonts/DarkGarden-copying.txt',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   220
        'fonts/DarkGarden-readme.txt',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   221
        'fonts/DarkGarden.sfd',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   222
        'fonts/DarkGardenMK.afm',
beca8d75f400 reportlab: remove LetErrorRobot-Chrome, rina & luxi. Add DarkGardenMK and fix tests
rgbecker
parents: 2976
diff changeset
   223
        'fonts/DarkGardenMK.pfb',
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   224
        'fonts/Vera.ttf',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   225
        'fonts/VeraBd.ttf',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   226
        'fonts/VeraBI.ttf',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   227
        'fonts/VeraIt.ttf',
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   228
        'fonts/_abi____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   229
        'fonts/_ab_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   230
        'fonts/_ai_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   231
        'fonts/_a______.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   232
        'fonts/cobo____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   233
        'fonts/cob_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   234
        'fonts/com_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   235
        'fonts/coo_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   236
        'fonts/_ebi____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   237
        'fonts/_eb_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   238
        'fonts/_ei_____.pfb',
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   239
        'fonts/_er_____.pfb',
3549
2c6e68e56e02 setup.py: use a versioned pfbfer.zip
rgbecker
parents: 3396
diff changeset
   240
        'fonts/sy______.pfb',
2c6e68e56e02 setup.py: use a versioned pfbfer.zip
rgbecker
parents: 3396
diff changeset
   241
        'fonts/zd______.pfb',
2c6e68e56e02 setup.py: use a versioned pfbfer.zip
rgbecker
parents: 3396
diff changeset
   242
        'fonts/zx______.pfb',
2c6e68e56e02 setup.py: use a versioned pfbfer.zip
rgbecker
parents: 3396
diff changeset
   243
        'fonts/zy______.pfb',
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   244
        ]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   245
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   246
def get_fonts(PACKAGE_DIR, reportlab_files):
3785
974819935ede setup.py: fix python3 badness
robin
parents: 3764
diff changeset
   247
    import sys, os, os.path, zipfile, io
974819935ede setup.py: fix python3 badness
robin
parents: 3764
diff changeset
   248
    if isPy3:
974819935ede setup.py: fix python3 badness
robin
parents: 3764
diff changeset
   249
        import urllib.request as ureq
974819935ede setup.py: fix python3 badness
robin
parents: 3764
diff changeset
   250
    else:
974819935ede setup.py: fix python3 badness
robin
parents: 3764
diff changeset
   251
        import urllib2 as ureq
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   252
    rl_dir = PACKAGE_DIR['reportlab']
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   253
    if not [x for x in reportlab_files if not os.path.isfile(pjoin(rl_dir,x))]:
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   254
        infoline("Standard T1 font curves already downloaded")
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   255
        return
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   256
    elif not dlt1:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   257
        infoline('not downloading T1 font curve files')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   258
        return
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   259
    try:
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   260
        infoline("Downloading standard T1 font curves")
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   261
3785
974819935ede setup.py: fix python3 badness
robin
parents: 3764
diff changeset
   262
        remotehandle = ureq.urlopen("http://www.reportlab.com/ftp/pfbfer-20070710.zip")
3764
010823faf496 setup.py: fix download of T1 files in python3
robin
parents: 3752
diff changeset
   263
        zipdata = io.BytesIO(remotehandle.read())
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   264
        remotehandle.close()
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   265
        archive = zipfile.ZipFile(zipdata)
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   266
        dst = pjoin(rl_dir, 'fonts')
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   267
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   268
        for name in archive.namelist():
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   269
            if not name.endswith('/'):
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   270
                outfile = open(os.path.join(dst, name), 'wb')
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   271
                outfile.write(archive.read(name))
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   272
                outfile.close()
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   273
        xitmsg = "Finished download of standard T1 font curves"
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   274
    except:
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   275
        xitmsg = "Failed to download standard T1 font curves"
3328
4d7f836cd947 reportlab: fix 2to3 warnings
rgbecker
parents: 3303
diff changeset
   276
    reportlab_files = [x for x in reportlab_files if os.path.isfile(pjoin(rl_dir,x))]
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   277
    infoline(xitmsg)
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   278
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   279
def main():
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   280
    #test to see if we've a special command
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   281
    if 'tests' in sys.argv or 'tests-preinstall' in sys.argv:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   282
        if len(sys.argv)!=2:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   283
            raise ValueError('tests commands may only be used alone')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   284
        cmd = sys.argv[-1]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   285
        PYTHONPATH=[pkgDir]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   286
        if cmd=='tests-preinstall':
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   287
            PYTHONPATH.insert(0,pjoin(pkgDir,'src'))
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   288
        os.environ['PYTHONPATH']=os.pathsep.join(PYTHONPATH)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   289
        os.chdir(pjoin(pkgDir,'tests'))
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   290
        os.system("%s runAll.py" % sys.executable)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   291
        return
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   292
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   293
    debug_compile_args = []
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   294
    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
   295
    debug_macros = []
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   296
    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
   297
    if debug:
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   298
        if sys.platform == 'win32':
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   299
            debug_compile_args=['/Zi']
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   300
            debug_link_args=['/DEBUG']
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   301
            if debug>1:
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   302
                debug_macros.extend([('RL_DEBUG',debug), ('ROBIN_DEBUG',None)])
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   303
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   304
    SPECIAL_PACKAGE_DATA = {}
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   305
    RL_ACCEL = _find_rl_ccode('rl_accel','_rl_accel.c')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   306
    LIBRARIES=[]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   307
    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
   308
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   309
    if not RL_ACCEL:
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   310
        infoline( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   311
        infoline( 'not attempting build of the _rl_accel extension')
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   312
        infoline( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   313
    else:
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   314
        infoline( '================================================')
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   315
        infoline( 'Attempting build of _rl_accel & pyHnj')
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   316
        infoline( 'extensions from %r'%RL_ACCEL)
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   317
        infoline( '================================================')
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   318
        fn = pjoin(RL_ACCEL,'hyphen.mashed')
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   319
        SPECIAL_PACKAGE_DATA = {fn: pjoin('lib','hyphen.mashed')}
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   320
        EXT_MODULES += [
3727
67e69a84138b changes to bring into line with new Python 3.3.0 universe
robin
parents: 3724
diff changeset
   321
                    Extension( 'reportlab.lib._rl_accel',
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   322
                                [pjoin(RL_ACCEL,'_rl_accel.c')],
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   323
                                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
   324
                            define_macros=[]+debug_macros,
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   325
                            library_dirs=[],
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   326
                            libraries=[], # libraries to link against
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   327
                            extra_compile_args=debug_compile_args,
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   328
                            extra_link_args=debug_link_args,
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   329
                            ),
3733
e31cab3e5146 temporarily remove some extensions
robin
parents: 3727
diff changeset
   330
                        ]
3785
974819935ede setup.py: fix python3 badness
robin
parents: 3764
diff changeset
   331
        if not isPy3:
3733
e31cab3e5146 temporarily remove some extensions
robin
parents: 3727
diff changeset
   332
            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
   333
                    Extension( 'reportlab.lib.pyHnj',
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   334
                            [pjoin(RL_ACCEL,'pyHnjmodule.c'),
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   335
                            pjoin(RL_ACCEL,'hyphen.c'),
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   336
                            pjoin(RL_ACCEL,'hnjalloc.c')],
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   337
                            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
   338
                            define_macros=[]+debug_macros,
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   339
                            library_dirs=[],
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   340
                            libraries=[], # libraries to link against
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   341
                            extra_compile_args=debug_compile_args,
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   342
                            extra_link_args=debug_link_args,
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   343
                            ),
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   344
                        ]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   345
    RENDERPM = _find_rl_ccode('renderPM','_renderPM.c')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   346
    if not RENDERPM:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   347
        infoline( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   348
        infoline( 'not attempting build of _renderPM')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   349
        infoline( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   350
    else:
4308
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   351
        infoline( '================================================')
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   352
        infoline( 'Attempting build of _renderPM')
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   353
        infoline( 'extensions from %r'%RENDERPM)
dba801107fd1 fix spurious web references
robin <robin@reportlab.com>
parents: 4306
diff changeset
   354
        infoline( '================================================')
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   355
        GT1_DIR=pjoin(RENDERPM,'gt1')
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   356
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   357
        #check for an installed libart
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   358
        if isla:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   359
            LIBART_INC=None
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   360
        else:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   361
            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
   362
        if LIBART_INC:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   363
            def installed_libart_version(fn):
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   364
                for l in open(fn, 'r').readlines():
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   365
                    if l.startswith('#define LIBART_VERSION'):
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   366
                        v = l[:-1].split(' ')[-1]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   367
                        return v
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   368
                return '"0.0.0"'
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   369
            LIBART_INC = LIBART_INC[-1]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   370
            LIBART_VERSION = installed_libart_version(LIBART_INC)
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   371
            LIBART_INC = os.path.dirname(LIBART_INC)
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   372
            LIBART_SOURCES=[]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   373
            LIBART_LIB = ['art_lgpl_2']
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   374
            infoline('will use installed libart %s' % LIBART_VERSION.replace('"',''))
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   375
        else:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   376
            LIBART_DIR = LIBART_INC = pjoin(RENDERPM,'libart_lgpl')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   377
            LIBART_LIB = []
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   378
            LIBART_SOURCES=[
3278
ce6c49bb9dc3 setup.py modified to work with easy_install (C extensions referred to explicitly)
damian
parents: 3168
diff changeset
   379
                    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
   380
                    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
   381
                    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
   382
                    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
   383
                    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
   384
                    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
   385
                    pjoin(LIBART_DIR,'art_svp_ops.c'),
4306
8ffb2ffc283b support for Path autoclose & fillMode; version --> 3.3.29
robin
parents: 4303
diff changeset
   386
                    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
   387
                    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
   388
                    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
   389
                    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
   390
                    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
   391
                    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
   392
                    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
   393
                    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
   394
                    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
   395
                    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
   396
                    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
   397
                    pjoin(LIBART_DIR,'art_misc.c'),
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   398
                    ]
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   399
            def libart_version():
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   400
                K = ('LIBART_MAJOR_VERSION','LIBART_MINOR_VERSION','LIBART_MICRO_VERSION')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   401
                D = {}
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   402
                for l in open(pjoin(LIBART_DIR,'configure.in'),'r').readlines():
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   403
                    l = l.strip().split('=')
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   404
                    if len(l)>1 and l[0].strip() in K:
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   405
                        D[l[0].strip()] = l[1].strip()
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   406
                        if len(D)==3: break
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   407
                return (sys.platform == 'win32' and '\\"%s\\"' or '"%s"') % '.'.join(map(lambda k,D=D: D.get(k,'?'),K))
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   408
            LIBART_VERSION = libart_version()
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   409
            infoline('will use package libart %s' % LIBART_VERSION.replace('"',''))
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   410
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   411
        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
   412
                    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
   413
                    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
   414
                    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
   415
                    pjoin(GT1_DIR,'gt1-region.c'),
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   416
                    ]+LIBART_SOURCES
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   417
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   418
        if platform=='win32':
4142
099ebb771226 change setup.py & setup.cfg to reflect building on windows 7 amd64 machine; bump to 3.1.39
robin
parents: 4079
diff changeset
   419
            from distutils.util import get_platform
099ebb771226 change setup.py & setup.cfg to reflect building on windows 7 amd64 machine; bump to 3.1.39
robin
parents: 4079
diff changeset
   420
            secname = 'FREETYPE_PATHS_%s' % get_platform().split('-')[-1].upper()
3396
bd34035b79b0 setup.py/cfg: regularize var names
rgbecker
parents: 3394
diff changeset
   421
            FT_LIB=os.environ.get('FT_LIB','')
4142
099ebb771226 change setup.py & setup.cfg to reflect building on windows 7 amd64 machine; bump to 3.1.39
robin
parents: 4079
diff changeset
   422
            if not FT_LIB: FT_LIB=config(secname,'lib','')
3301
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   423
            if FT_LIB and not os.path.isfile(FT_LIB):
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   424
                infoline('# freetype lib %r not found' % FT_LIB)
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   425
                FT_LIB=[]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   426
            if FT_LIB:
3396
bd34035b79b0 setup.py/cfg: regularize var names
rgbecker
parents: 3394
diff changeset
   427
                FT_INC_DIR=os.environ.get('FT_INC','')
4142
099ebb771226 change setup.py & setup.cfg to reflect building on windows 7 amd64 machine; bump to 3.1.39
robin
parents: 4079
diff changeset
   428
                if not FT_INC_DIR: FT_INC_DIR=config(secname,'inc')
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   429
                FT_MACROS = [('RENDERPM_FT',None)]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   430
                FT_LIB_DIR = [dirname(FT_LIB)]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   431
                FT_INC_DIR = [FT_INC_DIR or pjoin(dirname(FT_LIB_DIR[0]),'include')]
3352
753cbc1ed53f setup.py: allow win32 FT libs to come from the environment
rgbecker
parents: 3328
diff changeset
   432
                FT_LIB_PATH = FT_LIB
3943
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   433
                FT_LIB = [os.path.splitext(os.path.basename(FT_LIB))[0]]
0e897efde30f sgmlop.c: allow compilation in Python 3.3 & 2.7, with new returnUnicode option as default
robin
parents: 3878
diff changeset
   434
                if isdir(FT_INC_DIR[0]):
3352
753cbc1ed53f setup.py: allow win32 FT libs to come from the environment
rgbecker
parents: 3328
diff changeset
   435
                    infoline('# installing with freetype %r' % FT_LIB_PATH)
3301
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   436
                else:
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   437
                    infoline('# freetype2 include folder %r not found' % FT_INC_DIR[0])
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   438
                    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
   439
            else:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   440
                FT_LIB=FT_LIB_DIR=FT_INC_DIR=FT_MACROS=[]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   441
        else:
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   442
            if os.path.isdir('/usr/include/freetype2'):
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   443
                FT_LIB_DIR = []
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   444
                FT_INC_DIR = ['/usr/include/freetype2']
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   445
            else:
4142
099ebb771226 change setup.py & setup.cfg to reflect building on windows 7 amd64 machine; bump to 3.1.39
robin
parents: 4079
diff changeset
   446
                FT_LIB_DIR=config('FREETYPE_PATHS','lib')
099ebb771226 change setup.py & setup.cfg to reflect building on windows 7 amd64 machine; bump to 3.1.39
robin
parents: 4079
diff changeset
   447
                FT_LIB_DIR=[FT_LIB_DIR] if FT_LIB_DIR else []
099ebb771226 change setup.py & setup.cfg to reflect building on windows 7 amd64 machine; bump to 3.1.39
robin
parents: 4079
diff changeset
   448
                FT_INC_DIR=config('FREETYPE_PATHS','inc')
099ebb771226 change setup.py & setup.cfg to reflect building on windows 7 amd64 machine; bump to 3.1.39
robin
parents: 4079
diff changeset
   449
                FT_INC_DIR=[FT_INC_DIR] if FT_INC_DIR else []
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   450
            I,L=inc_lib_dirs()
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   451
            ftv = None
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   452
            for d in I:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   453
                if isfile(pjoin(d, "ft2build.h")):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   454
                    ftv = 21
2976
8275469b0747 setup.py: now works on freeBSD; how _rl_accel_dir_info ever got by I know not
rptlab
parents: 2963
diff changeset
   455
                    FT_INC_DIR=[d,pjoin(d, "freetype2")]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   456
                    break
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   457
                d = pjoin(d, "freetype2")
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   458
                if isfile(pjoin(d, "ft2build.h")):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   459
                    ftv = 21
2976
8275469b0747 setup.py: now works on freeBSD; how _rl_accel_dir_info ever got by I know not
rptlab
parents: 2963
diff changeset
   460
                    FT_INC_DIR=[d]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   461
                    break
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   462
                if isdir(pjoin(d, "freetype")):
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   463
                    ftv = 20
2976
8275469b0747 setup.py: now works on freeBSD; how _rl_accel_dir_info ever got by I know not
rptlab
parents: 2963
diff changeset
   464
                    FT_INC_DIR=[d]
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   465
                    break
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   466
            if ftv:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   467
                FT_LIB=['freetype']
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   468
                FT_LIB_DIR=L
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   469
                FT_MACROS = [('RENDERPM_FT',None)]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   470
                infoline('# installing with freetype version %d' % ftv)
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   471
            else:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   472
                FT_LIB=FT_LIB_DIR=FT_INC_DIR=FT_MACROS=[]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   473
        if not FT_LIB:
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   474
            infoline('# installing without freetype no ttf, sorry!')
3301
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   475
            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
   476
            infoline('# If you need truetype support in renderPM')
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   477
            infoline('# You may need to edit setup.cfg (win32)')
31f20768f8c1 fix for missing freetype2 lib in win32 environment
juraj
parents: 3285
diff changeset
   478
            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
   479
3727
67e69a84138b changes to bring into line with new Python 3.3.0 universe
robin
parents: 3724
diff changeset
   480
        EXT_MODULES +=  [Extension( 'reportlab.graphics._renderPM',
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   481
                                        SOURCES,
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   482
                                        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
   483
                                        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
   484
                                        library_dirs=[]+FT_LIB_DIR,
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   485
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   486
                                        # libraries to link against
3974
d55126858ada setup.py: add suggestions from Matthias Klose
robin
parents: 3962
diff changeset
   487
                                        libraries=FT_LIB+LIBART_LIB,
3878
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   488
                                        extra_compile_args=debug_compile_args,
e92f92078158 allow debug for win32 in setup.py
robin
parents: 3864
diff changeset
   489
                                        extra_link_args=debug_link_args,
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   490
                                        ),
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   491
                            ]
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   492
        infoline('################################################')
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   493
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   494
    #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
   495
    PACKAGE_DIR = {'':'src','reportlab': pjoin('src','reportlab')}
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   496
    for fn,dst in SPECIAL_PACKAGE_DATA.items():
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   497
        shutil.copyfile(fn,pjoin(PACKAGE_DIR['reportlab'],dst))
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   498
        reportlab_files.append(dst)
3285
af395f8ca4a2 setup.py now downloads T1 font curves when using easy_install or distutils
damian
parents: 3278
diff changeset
   499
    get_fonts(PACKAGE_DIR, reportlab_files)
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   500
    try:
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   501
        setup(
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   502
            name="reportlab",
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   503
            version=get_version(),
4208
f93e6b1c6f61 update Copyright
robin
parents: 4157
diff changeset
   504
            license="BSD license (see license.txt for details), Copyright (c) 2000-2015, ReportLab Inc.",
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   505
            description="The Reportlab Toolkit",
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   506
            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
   507
3303
c755d7c0d53d author list and contact details updated
meitham
parents: 3301
diff changeset
   508
            author="Andy Robinson, Robin Becker, the ReportLab team and the community",
c755d7c0d53d author list and contact details updated
meitham
parents: 3301
diff changeset
   509
            author_email="reportlab-users@lists2.reportlab.com",
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   510
            url="http://www.reportlab.com/",
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   511
            packages=[
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   512
                    'reportlab',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   513
                    'reportlab.graphics.charts',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   514
                    'reportlab.graphics.samples',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   515
                    'reportlab.graphics.widgets',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   516
                    'reportlab.graphics.barcode',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   517
                    'reportlab.graphics',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   518
                    'reportlab.lib',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   519
                    'reportlab.pdfbase',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   520
                    'reportlab.pdfgen',
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   521
                    'reportlab.platypus',
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   522
                    ],
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   523
            package_dir = PACKAGE_DIR,
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   524
            package_data = {'reportlab': reportlab_files},
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   525
            ext_modules =   EXT_MODULES,
4225
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   526
            classifiers = [
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   527
                'Development Status :: 5 - Production/Stable',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   528
                'Intended Audience :: Developers',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   529
                'License :: OSI Approved :: BSD License',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   530
                'Topic :: Printing',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   531
                'Topic :: Text Processing :: Markup',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   532
                'Programming Language :: Python :: 2',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   533
                'Programming Language :: Python :: 2.7',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   534
                'Programming Language :: Python :: 3',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   535
                'Programming Language :: Python :: 3.3',
bc6ca1679f8f setup.py: apply classifiers as suggested by https://bitbucket.org/pmdarrow/
robin
parents: 4208
diff changeset
   536
                'Programming Language :: Python :: 3.4',
4282
d3a68f4690c2 add 3.5 in setup.py, update licencse, version-->3.3.15
robin
parents: 4252
diff changeset
   537
                'Programming Language :: Python :: 3.5',
4330
617ffa6bbdc8 changes for release 3.4.0
robin <robin@reportlab.com>
parents: 4314
diff changeset
   538
                'Programming Language :: Python :: 3.6',
4226
10f62c8dd584 add comma
robin
parents: 4225
diff changeset
   539
                ],
4061
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
   540
            
2c1231a04768 setup.py: make setuptools usage optional
robin
parents: 4060
diff changeset
   541
            #this probably only works for setuptools, but distutils seems to ignore it
4079
4df3c1696c1b setup.py: pillow >=2.4.0 only (fixes buildout failure), bump version to 3.1.9
robin
parents: 4072
diff changeset
   542
            install_requires=['pillow>=2.4.0','pip>=1.4.1', 'setuptools>=2.2'],
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   543
            )
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   544
        print()
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   545
        print('########## SUMMARY INFO #########')
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   546
        print('\n'.join(INFOLINES))
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   547
    finally:
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3619
diff changeset
   548
        for dst in SPECIAL_PACKAGE_DATA.values():
2982
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   549
            os.remove(pjoin(PACKAGE_DIR['reportlab'],dst))
32b005bb6879 reportlab: lastminute changes before 2.2 tagging
rgbecker
parents: 2977
diff changeset
   550
            reportlab_files.remove(dst)
2963
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   551
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   552
if __name__=='__main__':
c414c0ab69e7 reportlab-2.2: first stage of major re-org
rgbecker
parents:
diff changeset
   553
    main()