root/PythonPackages/OpenOpt/setup.py

Revision 1048, 3.7 kB (checked in by dmitrey, 1 year ago)

changes toward Python3 compatibility

Line 
1 #! /usr/bin/env python
2
3 descr   = """
4 """
5
6 from os.path import join
7 import os
8 import sys, compileall
9
10 DISTNAME            = 'openopt'
11 DESCRIPTION         = 'A python module for numerical optimization'
12 LONG_DESCRIPTION    = descr
13 MAINTAINER          = 'Dmitrey Kroshko',
14 MAINTAINER_EMAIL    = 'dmitrey-at-openopt-dot-org',
15 URL                 = 'http://openopt.org',
16 LICENSE             = 'new BSD'
17
18 sys.path.append(os.getcwd() + os.sep + 'openopt')
19 from ooVersionNumber import __version__ as ooVer
20 openopt_version = ooVer
21
22 DOWNLOAD_URL        = 'http://openopt.org/images/3/33/OpenOpt.zip'
23
24 try:
25     import setuptools
26 except:
27     print('you should have setuptools installed (http://pypi.python.org/pypi/setuptools), for some Linux distribs you can get it via [sudo] apt-get install python-setuptools')
28     print('press Enter for exit...')
29     raw_input()
30     exit()
31    
32 from distutils.errors import DistutilsError
33 #from numpy.distutils.system_info import system_info, NotFoundError, dict_append, so_ext
34 from numpy.distutils.core import setup, Extension
35
36 DOC_FILES = []
37
38 def configuration(parent_package='',top_path=None, package_name=DISTNAME):
39     if os.path.exists('MANIFEST'): os.remove('MANIFEST')
40     pkg_prefix_dir = 'openopt'
41
42     # Get the version
43
44     from numpy.distutils.misc_util import Configuration
45     config = Configuration(package_name,parent_package,top_path,
46         version     = openopt_version,
47         maintainer  = MAINTAINER,
48         maintainer_email = MAINTAINER_EMAIL,
49         description = DESCRIPTION,
50         license = LICENSE,
51         url = URL,
52         download_url = DOWNLOAD_URL,
53         long_description = LONG_DESCRIPTION)
54
55
56     # XXX: once in SVN, should add svn version...
57     #print config.make_svn_version_py()
58
59     # package_data does not work with sdist for setuptools 0.5 (setuptools bug),
60     # so we need to add them here while the bug is not solved...
61
62     return config
63
64
65 if __name__ == "__main__":
66 #    solverPaths = {}
67 #    #File = string.join(__file__.split(os.sep)[:-1], os.sep)
68 #    for root, dirs, files in os.walk('openopt'+os.sep +'solvers'):
69 #        #for root, dirs, files in os.walk(os.path.dirname(file)+os.sep+'solvers'):
70 #        rd = root.split(os.sep)
71 #        if '.svn' in rd: continue
72 #        rd = rd[rd.index('solvers')+1:]
73 #        for file in files:
74 #            if len(file)>6 and file[-6:] == '_oo.py':
75 #                solverPaths[file[:-6]] = string.join(rd,'.') + '.'+file[:-3]
76 #    f = open('solverPaths.py', 'w')
77 #    f.write('solverPaths = ' + str(solverPaths))
78 #    f.close()
79 #    shutil.move('solverPaths.py', 'openopt' + os.sep + 'kernel' + os.sep + 'solverPaths.py')
80
81
82
83     # setuptools version of config script
84
85     # package_data does not work with sdist for setuptools 0.5 (setuptools bug)
86     # So we cannot add data files via setuptools yet.
87
88     #data_files = ['test_data/' + i for i in TEST_DATA_FILES]
89     #data_files.extend(['docs/' + i for i in doc_files])
90     setup(configuration = configuration,
91         install_requires=['numpy','setproctitle'], # can also add version specifiers   #namespace_packages=['kernel'],
92         #setup_requires = 'setproctitle',
93         #py_modules = ['kernel', 'tests', 'examples', 'solvers'],
94         packages=setuptools.find_packages(),
95         include_package_data = True,
96         #package_data = '*.txt',
97         test_suite='',#"openopt.tests", # for python setup.py test
98         zip_safe=False, # the package can run out of an .egg file
99         #FIXME url, download_url, ext_modules
100         classifiers =
101             [ 'Development Status :: 4 - Beta',
102               'Environment :: Console',
103               'Intended Audience :: Developers',
104               'Intended Audience :: Science/Research',
105               'License :: OSI Approved :: BSD License',
106               'Topic :: Scientific/Engineering']
107     )
Note: See TracBrowser for help on using the browser.