1from sys import executable
2from os.path import join as pjoin
3from os.path import dirname
4
5setuptools_import_error_message = """setuptools is not installed for """ + executable + """
6Please follow this link for installing instructions :
7https://pypi.python.org/pypi/setuptools
8make sure you use \"""" + executable + """\" during the installation"""
9
10try:
11    from setuptools import find_packages, setup
12    from setuptools.dist import Distribution
13    from setuptools.command.install import install
14except ImportError:
15    raise ImportError(setuptools_import_error_message)
16
17
18class BinaryDistribution(Distribution):
19    def is_pure(self):
20        return False
21
22    def has_ext_modules(self):
23        return True
24
25
26class InstallPlatlib(install):
27    def finalize_options(self):
28        install.finalize_options(self)
29        self.install_lib = self.install_platlib
30
31
32# Utility function to read the README file.
33# Used for the long_description.  It's nice, because now 1) we have a top level
34# README file and 2) it's easier to type in the README file than to put a raw
35# string in below ...
36def read(fname):
37    return open(pjoin(dirname(__file__), fname)).read()
38
39
40setup(
41    name='@PROJECT_NAME@',
42    version='@PROJECT_VERSION@',
43    packages=find_packages(),
44    python_requires='>= 3.6',
45    install_requires=[
46        #'absl-py >= 0.13',
47        #'numpy >= 1.13.3',
48        #'protobuf >= 3.19.1',
49    ],
50    package_data={
51        '@PROJECT_NAME@':[$<$<STREQUAL:$<TARGET_PROPERTY:@PYTHON_PROJECT@,TYPE>,SHARED_LIBRARY>:'.libs/*', '../$<TARGET_SONAME_FILE_NAME:@PYTHON_PROJECT@>'>],
52        '@PROJECT_NAME@.init':['$<TARGET_FILE_NAME:pywrapinit>'],
53        '@PROJECT_NAME@.algorithms':['$<TARGET_FILE_NAME:pywrapknapsack_solver>'],
54        '@PROJECT_NAME@.graph':['$<TARGET_FILE_NAME:pywrapgraph>'],
55        '@PROJECT_NAME@.constraint_solver':['$<TARGET_FILE_NAME:pywrapcp>', '*.pyi'],
56        '@PROJECT_NAME@.linear_solver':['$<TARGET_FILE_NAME:pywraplp>', '*.pyi'],
57        '@PROJECT_NAME@.packing':['*.pyi'],
58        '@PROJECT_NAME@.sat':['$<TARGET_FILE_NAME:pywrapsat>', '*.pyi'],
59        '@PROJECT_NAME@.scheduling':['$<TARGET_FILE_NAME:pywraprcpsp>', '*.pyi'],
60        '@PROJECT_NAME@.util':['$<TARGET_FILE_NAME:sorted_interval_list>', '*.pyi'],
61    },
62    include_package_data=True,
63    license='Apache 2.0',
64    author='Google LLC',
65    author_email='or-tools@google.com',
66    description='Google OR-Tools python libraries and modules',
67    long_description=read('README.txt'),
68    keywords=('operations research' + ', constraint programming' +
69              ', linear programming' + ', flow algorithms' + ', python'),
70    url='https://developers.google.com/optimization/',
71    download_url='https://github.com/google/or-tools/releases',
72    classifiers=[
73        'Development Status :: 5 - Production/Stable',
74        'Environment :: Console',
75        'Intended Audience :: Developers',
76        'Intended Audience :: Education',
77        'Intended Audience :: Information Technology',
78        'Intended Audience :: Science/Research',
79        'License :: OSI Approved :: Apache Software License',
80        'Operating System :: Unix',
81        'Operating System :: POSIX :: Linux',
82        'Operating System :: POSIX :: BSD :: FreeBSD',
83        'Operating System :: MacOS',
84        'Operating System :: MacOS :: MacOS X',
85        'Operating System :: Microsoft :: Windows',
86        'Programming Language :: Python',
87        'Programming Language :: Python :: 3',
88        'Programming Language :: Python :: 3 :: Only',
89        'Programming Language :: Python :: 3.6',
90        'Programming Language :: Python :: 3.7',
91        'Programming Language :: Python :: 3.8',
92        'Programming Language :: Python :: 3.9',
93        'Programming Language :: Python :: 3.10',
94        'Programming Language :: C++',
95        'Programming Language :: Python :: Implementation :: CPython',
96        'Topic :: Office/Business :: Scheduling',
97        'Topic :: Scientific/Engineering',
98        'Topic :: Scientific/Engineering :: Mathematics',
99        'Topic :: Software Development',
100        'Topic :: Software Development :: Libraries :: Python Modules',
101    ],
102    distclass=BinaryDistribution,
103    cmdclass={'install': InstallPlatlib},
104)
105