Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / setup.py @ 5cef0f13

History | View | Annotate | Download (5.61 KB)

1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
"""
4
Setup script for networkx
5

6
You can install networkx with
7

8
python setup.py install
9
"""
10
from glob import glob
11
import os
12
import sys
13
if os.path.exists('MANIFEST'):
14
    os.remove('MANIFEST')
15

    
16
from setuptools import setup
17

    
18
if sys.argv[-1] == 'setup.py':
19
    print("To install, run 'python setup.py install'")
20
    print()
21

    
22
if sys.version_info[:2] < (3, 5):
23
    error = """NetworkX 2.3+ requires Python 3.5 or later (%d.%d detected).
24
             
25
For Python 2.7, please install version 2.2 using:
26

27
$ pip install 'networkx==2.2'
28
""" % sys.version_info[:2]
29
    sys.stderr.write(error + "\n")
30
    sys.exit(1)
31

    
32
# Write the version information.
33
sys.path.insert(0, 'networkx')
34
import release
35
version = release.write_versionfile()
36
sys.path.pop(0)
37

    
38
packages = ["networkx",
39
            "networkx.algorithms",
40
            "networkx.algorithms.assortativity",
41
            "networkx.algorithms.bipartite",
42
            "networkx.algorithms.node_classification",
43
            "networkx.algorithms.centrality",
44
            "networkx.algorithms.community",
45
            "networkx.algorithms.components",
46
            "networkx.algorithms.connectivity",
47
            "networkx.algorithms.coloring",
48
            "networkx.algorithms.flow",
49
            "networkx.algorithms.traversal",
50
            "networkx.algorithms.isomorphism",
51
            "networkx.algorithms.shortest_paths",
52
            "networkx.algorithms.link_analysis",
53
            "networkx.algorithms.operators",
54
            "networkx.algorithms.approximation",
55
            "networkx.algorithms.tree",
56
            "networkx.classes",
57
            "networkx.generators",
58
            "networkx.drawing",
59
            "networkx.linalg",
60
            "networkx.readwrite",
61
            "networkx.readwrite.json_graph",
62
            "networkx.tests",
63
            "networkx.testing",
64
            "networkx.utils"]
65

    
66
docdirbase = 'share/doc/networkx-%s' % version
67
# add basic documentation
68
data = [(docdirbase, glob("*.txt"))]
69
# add examples
70
for d in ['.',
71
          'advanced',
72
          'algorithms',
73
          'basic',
74
          '3d_drawing',
75
          'drawing',
76
          'graph',
77
          'javascript',
78
          'jit',
79
          'pygraphviz',
80
          'subclass']:
81
    dd = os.path.join(docdirbase, 'examples', d)
82
    pp = os.path.join('examples', d)
83
    data.append((dd, glob(os.path.join(pp, "*.txt"))))
84
    data.append((dd, glob(os.path.join(pp, "*.py"))))
85
    data.append((dd, glob(os.path.join(pp, "*.bz2"))))
86
    data.append((dd, glob(os.path.join(pp, "*.gz"))))
87
    data.append((dd, glob(os.path.join(pp, "*.mbox"))))
88
    data.append((dd, glob(os.path.join(pp, "*.edgelist"))))
89
# add js force examples
90
dd = os.path.join(docdirbase, 'examples', 'javascript/force')
91
pp = os.path.join('examples', 'javascript/force')
92
data.append((dd, glob(os.path.join(pp, "*"))))
93

    
94
# add the tests
95
package_data = {
96
    'networkx': ['tests/*.py'],
97
    'networkx.algorithms': ['tests/*.py'],
98
    'networkx.algorithms.assortativity': ['tests/*.py'],
99
    'networkx.algorithms.bipartite': ['tests/*.py'],
100
    'networkx.algorithms.node_classification': ['tests/*.py'],
101
    'networkx.algorithms.centrality': ['tests/*.py'],
102
    'networkx.algorithms.community': ['tests/*.py'],
103
    'networkx.algorithms.components': ['tests/*.py'],
104
    'networkx.algorithms.connectivity': ['tests/*.py'],
105
    'networkx.algorithms.coloring': ['tests/*.py'],
106
    'networkx.algorithms.flow': ['tests/*.py', 'tests/*.bz2'],
107
    'networkx.algorithms.isomorphism': ['tests/*.py', 'tests/*.*99'],
108
    'networkx.algorithms.link_analysis': ['tests/*.py'],
109
    'networkx.algorithms.approximation': ['tests/*.py'],
110
    'networkx.algorithms.operators': ['tests/*.py'],
111
    'networkx.algorithms.shortest_paths': ['tests/*.py'],
112
    'networkx.algorithms.traversal': ['tests/*.py'],
113
    'networkx.algorithms.tree': ['tests/*.py'],
114
    'networkx.classes': ['tests/*.py'],
115
    'networkx.generators': ['tests/*.py', 'atlas.dat.gz'],
116
    'networkx.drawing': ['tests/*.py'],
117
    'networkx.linalg': ['tests/*.py'],
118
    'networkx.readwrite': ['tests/*.py'],
119
    'networkx.readwrite.json_graph': ['tests/*.py'],
120
    'networkx.testing': ['tests/*.py'],
121
    'networkx.utils': ['tests/*.py']
122
}
123

    
124
install_requires = ['decorator>=4.3.0']
125
extras_require = {'all': ['numpy', 'scipy', 'pandas', 'matplotlib',
126
                          'pygraphviz', 'pydot', 'pyyaml', 'gdal', 'lxml',
127
                          'nose'],
128
                  'gdal': ['gdal'],
129
                  'lxml': ['lxml'],
130
                  'matplotlib': ['matplotlib'],
131
                  'nose': ['nose'],
132
                  'numpy': ['numpy'],
133
                  'pandas': ['pandas'],
134
                  'pydot': ['pydot'],
135
                  'pygraphviz': ['pygraphviz'],
136
                  'pyyaml': ['pyyaml'],
137
                  'scipy': ['scipy']
138
                 }
139

    
140
if __name__ == "__main__":
141

    
142
    setup(
143
        name=release.name.lower(),
144
        version=version,
145
        maintainer=release.maintainer,
146
        maintainer_email=release.maintainer_email,
147
        author=release.authors['Hagberg'][0],
148
        author_email=release.authors['Hagberg'][1],
149
        description=release.description,
150
        keywords=release.keywords,
151
        long_description=release.long_description,
152
        license=release.license,
153
        platforms=release.platforms,
154
        url=release.url,
155
        project_urls=release.project_urls,
156
        classifiers=release.classifiers,
157
        packages=packages,
158
        data_files=data,
159
        package_data=package_data,
160
        install_requires=install_requires,
161
        extras_require=extras_require,
162
        python_requires='>=3.5',
163
        test_suite='nose.collector',
164
        tests_require=['nose>=1.3.7'],
165
        zip_safe=False
166
    )