Ticket #9958: trac_9958-build_setuppy.patch

File trac_9958-build_setuppy.patch, 3.8 KB (added by fbissey, 10 years ago)

change needed in setup.py made it python version smart. I also scrubbed the debian stuff

  • setup.py

    # HG changeset patch
    # User Francois Bissey <francois.bissey@canterbury.ac.nz>
    # Date 1306208557 -43200
    # Node ID a4e3cf10da309b0e18e56c8d8caaaad7fdd8b053
    # Parent  c8177a3cd82e4a23ad7aba7a3a574950e6791e76
    #9958 update setup.py for python-2.7 - make it smarter and find the python version itself. Drop debian cruft.
    
    diff --git a/setup.py b/setup.py
    a b  
    4747    compile_result_dir = None
    4848    keep_going = False
    4949
    50 SITE_PACKAGES = '%s/lib/python/site-packages/'%SAGE_LOCAL
     50SITE_PACKAGES = '%s/lib/python%s/site-packages/'%(SAGE_LOCAL, sys.version[:3])
    5151if not os.path.exists(SITE_PACKAGES):
    52     SITE_PACKAGES = '%s/lib/python2.5/site-packages/'%SAGE_LOCAL
    53     if not os.path.exists(SITE_PACKAGES):
    54         SITE_PACKAGES = '%s/lib/python2.4/site-packages/'%SAGE_LOCAL
    55         if not os.path.exists(SITE_PACKAGES) and os.environ.has_key('SAGE_DEBIAN'):
    56             SITE_PACKAGES = '%s/lib/python2.5/site-packages/'%SAGE_LOCAL
    57             os.system('mkdir -p "%s"'%SITE_PACKAGES)
    58         if not os.path.exists(SITE_PACKAGES):       
    59             raise RuntimeError, "Unable to find site-packages directory (see setup.py file in sage python code)."
     52    raise RuntimeError, "Unable to find site-packages directory (see setup.py file in sage python code)."
    6053
    6154if not os.path.exists('build/sage'):
    6255    os.makedirs('build/sage')
     
    7265                '%s/sage/sage/ext'%SAGE_DEVEL]
    7366
    7467# search for dependencies only
    75 extra_include_dirs = ['%s/include/python2.6'%SAGE_LOCAL,
     68extra_include_dirs = ['%s/include/python%s'%(SAGE_LOCAL, sys.version[:3]),
    7669                      # finally, standard C/C++ include dirs
    7770                      '/usr/local/include/',   
    7871                      '/usr/include']
     
    8477except OSError:
    8578    pass
    8679
    87 
    88 #########################################################
    89 ### Debian-related stuff
    90 #########################################################
    91 
    92 if os.environ.has_key('SAGE_DEBIAN'):
    93     debian_include_dirs=["/usr/include",
    94                          "/usr/include/cudd",
    95                          "/usr/include/eclib",
    96                          "/usr/include/FLINT",
    97                          "/usr/include/fplll",
    98                          "/usr/include/givaro",
    99                          "/usr/include/gmp++",
    100                          "/usr/include/gsl",
    101                          "/usr/include/linbox",
    102                          "/usr/include/NTL",
    103                          "/usr/include/numpy",
    104                          "/usr/include/pari",
    105                          "/usr/include/polybori",
    106                          "/usr/include/polybori/groebner",
    107                          "/usr/include/qd",
    108                          "/usr/include/singular",
    109                          "/usr/include/singular/singular",
    110                          "/usr/include/symmetrica",
    111                          "/usr/share/python-support/cython/Cython/Includes/"
    112                          "/usr/share/pyshared/Cython/Includes/"
    113                          "/usr/include/zn_poly"]
    114     include_dirs = include_dirs + debian_include_dirs
    115 
    11680extra_compile_args = [ ]
    11781
    11882# comment these four lines out to turn on warnings from gcc
     
    204168for m in ext_modules:
    205169    m.libraries = ['csage'] + m.libraries + ['stdc++', 'ntl']
    206170    m.extra_compile_args += extra_compile_args # + ["-DCYTHON_REFNANNY"]
    207     if os.environ.has_key('SAGE_DEBIAN'):
    208         m.library_dirs += ['/usr/lib','/usr/lib/eclib','/usr/lib/singular','/usr/lib/R/lib','%s/lib' % SAGE_LOCAL]
    209     else:
    210         m.library_dirs += ['%s/lib' % SAGE_LOCAL]
     171    m.library_dirs += ['%s/lib' % SAGE_LOCAL]
    211172
    212173
    213174
     
    940901
    941902                     'sage.combinat.words',
    942903
    943                     'sage.combinat.iet',
     904                     'sage.combinat.iet',
    944905
    945906                     'sage.crypto',
    946907                     'sage.crypto.block_cipher',