|
18 | 18 | # See the License for the specific language governing permissions and |
19 | 19 | # limitations under the License. |
20 | 20 |
|
21 | | -import os |
| 21 | + |
| 22 | +from __future__ import print_function |
| 23 | + |
| 24 | +from os.path import dirname, join as path_join |
22 | 25 | try: |
23 | 26 | from setuptools import setup, Extension |
24 | 27 | except ImportError: |
|
30 | 33 | from Cython.Build import cythonize |
31 | 34 | from Cython.Distutils import build_ext |
32 | 35 | except ImportError: |
33 | | - cmdclass = {} |
34 | 36 | ext_modules = [ |
35 | 37 | Extension("neo4j.bolt._io", ["neo4j/bolt/_io.c"]), |
36 | 38 | Extension("neo4j.packstream._packer", ["neo4j/packstream/_packer.c"]), |
37 | 39 | Extension("neo4j.packstream._unpacker", ["neo4j/packstream/_unpacker.c"]), |
38 | 40 | ] |
39 | 41 | else: |
40 | | - cmdclass = {'build_ext': build_ext} |
41 | 42 | ext_modules = cythonize([Extension("*", ["**/*.pyx"])]) |
42 | 43 |
|
| 44 | +classifiers = [ |
| 45 | + "Intended Audience :: Developers", |
| 46 | + "License :: OSI Approved :: Apache Software License", |
| 47 | + "Operating System :: OS Independent", |
| 48 | + "Topic :: Database", |
| 49 | + "Topic :: Software Development", |
| 50 | + "Programming Language :: Python :: 2.7", |
| 51 | + "Programming Language :: Python :: 3.4", |
| 52 | + "Programming Language :: Python :: 3.5", |
| 53 | + "Programming Language :: Python :: 3.6", |
| 54 | +] |
| 55 | +packages = [ |
| 56 | + "neo4j", |
| 57 | + "neo4j.bolt", |
| 58 | + "neo4j.compat", |
| 59 | + "neo4j.packstream", |
| 60 | + "neo4j.v1", |
| 61 | +] |
| 62 | +package_data = { |
| 63 | + "neo4j.bolt": ["*.pyx"], |
| 64 | + "neo4j.packstream": ["*.pyx"], |
| 65 | +} |
| 66 | +setup_args = { |
| 67 | + "name": "neo4j-driver", |
| 68 | + "version": version, |
| 69 | + "description": "Neo4j Bolt driver for Python", |
| 70 | + "license": "Apache License, Version 2.0", |
| 71 | + "long_description": open(path_join(dirname(__file__), "README.rst")).read(), |
| 72 | + "author": "Neo Technology", |
| 73 | + "author_email": "drivers@neo4j.com", |
| 74 | + "keywords": "neo4j graph database", |
| 75 | + "url": "https://github.com/neo4j/neo4j-python-driver", |
| 76 | + "classifiers": classifiers, |
| 77 | + "packages": packages, |
| 78 | + "ext_modules": ext_modules, |
| 79 | +} |
43 | 80 |
|
44 | | -# Used for reading the README into long_description below. |
45 | | -def read(fname): |
46 | | - return open(os.path.join(os.path.dirname(__file__), fname)).read() |
47 | | - |
48 | | - |
49 | | -setup(name="neo4j-driver", |
50 | | - version=version, |
51 | | - description="Neo4j Bolt driver for Python", |
52 | | - license="Apache License, Version 2.0", |
53 | | - long_description=read("README.rst"), |
54 | | - author="Neo Technology", |
55 | | - author_email="drivers@neo4j.com", |
56 | | - keywords="neo4j graph database", |
57 | | - url="https://github.com/neo4j/neo4j-python-driver", |
58 | | - classifiers=[ |
59 | | - "Intended Audience :: Developers", |
60 | | - "License :: OSI Approved :: Apache Software License", |
61 | | - "Operating System :: OS Independent", |
62 | | - "Topic :: Database", |
63 | | - "Topic :: Software Development", |
64 | | - "Programming Language :: Python :: 2.7", |
65 | | - "Programming Language :: Python :: 3.4", |
66 | | - "Programming Language :: Python :: 3.5", |
67 | | - "Programming Language :: Python :: 3.6", |
68 | | - ], |
69 | | - packages=["neo4j", "neo4j.bolt", "neo4j.compat", "neo4j.packstream", "neo4j.v1"], |
70 | | - ext_modules=ext_modules) |
| 81 | +try: |
| 82 | + setup(**setup_args) |
| 83 | +except SystemExit: |
| 84 | + print("Compilation failed, falling back to pure Python.") |
| 85 | + del setup_args["ext_modules"] |
| 86 | + setup(**setup_args) |
0 commit comments