forked from pygraphviz/pygraphviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
94 lines (82 loc) · 3.07 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup script for PyGraphviz
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from glob import glob
import os
from setuptools import setup, Extension
import sys
from setup_commands import AddExtensionDevelopCommand, AddExtensionInstallCommand
from setup_extra import get_graphviz_dirs
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
if sys.argv[-1] == 'setup.py':
print("To install, run 'python setup.py install'")
print()
if sys.version_info[:2] < (2, 7):
print("PyGraphviz requires Python version 2.7 or later (%d.%d detected)." %
sys.version_info[:2])
sys.exit(-1)
# Write the version information.
#TODO rework this import hack with import graphviz.release or import graphviz.version ( doesn't work now because of code in the __init__)
sys.path.insert(0, 'pygraphviz')
import release
release.write_versionfile()
sys.path.pop(0)
packages = ["pygraphviz", "pygraphviz.tests"]
docdirbase = 'share/doc/pygraphviz-%s' % release.version
data = [
(docdirbase, glob("*.txt")),
(os.path.join(docdirbase, 'examples'), glob("examples/*.py")),
(os.path.join(docdirbase, 'examples'), glob("examples/*.dat")),
(os.path.join(docdirbase, 'examples'), glob("examples/*.dat.gz")),
]
package_data = {'': ['*.txt'], }
if __name__ == "__main__":
define_macros = []
if sys.platform == "win32":
define_macros = define_macros.append(('GVDLL', None))
extension = [
Extension(
"pygraphviz._graphviz",
["pygraphviz/graphviz_wrap.c"],
include_dirs=[],
library_dirs=[],
# cdt does not link to cgraph, whereas cgraph links to cdt.
# thus, cdt needs to come first in the library list to be sure
# that both libraries are linked in the final built .so (if cgraph
# is first, the implicit inclusion of cdt can lead to an incomplete
# link list, having only cdt and preventing the module from being loaded with
# undefined symbol errors. seen under PyPy on Linux.)
libraries=["cdt", "cgraph"],
define_macros=define_macros
)
]
setup(
name=release.name,
version=release.version,
author=release.authors['Hagberg'][0],
author_email=release.authors['Hagberg'][1],
description=release.description,
keywords=release.keywords,
long_description=release.long_description,
license=release.license,
platforms=release.platforms,
url=release.url,
download_url=release.download_url,
classifiers=release.classifiers,
packages=packages,
data_files=data,
ext_modules=extension,
cmdclass={
'install': AddExtensionInstallCommand,
'develop': AddExtensionDevelopCommand,
},
package_data=package_data,
include_package_data = True,
test_suite='nose.collector',
tests_require=['nose>=1.3.7', 'doctest-ignore-unicode>=0.1.2', 'mock>=2.0.0'],
)