-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathsetup.py
148 lines (131 loc) · 4.49 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
"""Setup script for PyFFI."""
import os
import sys
if sys.version_info < (3, 3):
raise RuntimeError("PyFFI requires Python 3.3 or higher.")
NAME = "PyFFI"
with open("pyffi/VERSION", "rt") as f:
VERSION = f.read().strip()
PACKAGES = [
'pyffi',
'pyffi.object_models',
'pyffi.object_models.xml',
'pyffi.object_models.xsd',
'pyffi.utils',
'pyffi.formats',
'pyffi.formats.nif',
'pyffi.formats.kfm',
'pyffi.formats.cgf',
'pyffi.formats.dds',
'pyffi.formats.tga',
'pyffi.formats.egm',
'pyffi.formats.egt',
'pyffi.formats.esp',
'pyffi.formats.tri',
'pyffi.formats.bsa',
'pyffi.formats.psk',
'pyffi.formats.rockstar',
'pyffi.formats.rockstar.dir_',
'pyffi.spells',
'pyffi.spells.cgf',
'pyffi.spells.nif',
'pyffi.qskope',
'pyffi.formats.dae']
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'License :: OSI Approved :: BSD License',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Topic :: Multimedia :: Graphics :: 3D Modeling',
'Programming Language :: Python',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Operating System :: OS Independent']
try:
LONG_DESCRIPTION = open("README.rst").read()
except IOError:
LONG_DESCRIPTION = open("README.TXT").read()
# include xml, xsd, dll, and exe files
PACKAGE_DATA = {'': ['*.xml', '*.xsd', '*.dll', '*.exe'],
'pyffi.formats.nif': ['nifxml/nif.xml'],
'pyffi.formats.kfm': ['kfmxml/kfm.xml'],
'pyffi': ['VERSION'],
}
SCRIPTS = ['scripts/nif/nifmakehsl.py',
'scripts/nif/niftoaster.py',
'scripts/cgf/cgftoaster.py',
'scripts/kfm/kfmtoaster.py',
'scripts/rockstar_pack_dir_img.py',
'scripts/rockstar_unpack_dir_img.py',
'scripts/patch_recursive_make.py',
'scripts/patch_recursive_apply.py',
'scripts/qskope.py']
AUTHOR = "Niftools Developers"
AUTHOR_EMAIL = "[email protected]"
LICENSE = "BSD"
KEYWORDS = "fileformat nif cgf binary interface stripify"
PLATFORMS = ["any"]
DESCRIPTION = "Processing block structured binary files."
URL = "https://github.com/niftools/pyffi"
DOWNLOAD_URL = "https://github.com/niftools/pyffi/releases"
try:
from sphinx.setup_command import BuildDoc
except ImportError:
from pyffi.utils import BuildDoc
CMD_CLASS = {'build_docs': BuildDoc}
COMMAND_OPTIONS = {
'build_docs': {
'project': ('setup.py', "PyFFI"),
'version': ('setup.py', VERSION),
'release': ('setup.py', VERSION),
'source_dir': ('setup.py', 'docs/')
}
}
params = dict(
name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
packages=PACKAGES,
package_data=PACKAGE_DATA,
scripts=SCRIPTS,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
download_url=DOWNLOAD_URL,
cmdclass=CMD_CLASS,
command_options=COMMAND_OPTIONS,
classifiers=CLASSIFIERS,
keywords=KEYWORDS,
extras_require={}
)
REQ_DIR = os.path.join(os.path.dirname(__file__), "requirements")
def parse_requirements(requirement_file):
requirements = []
req_path = os.path.join(REQ_DIR, requirement_file)
with open(req_path) as file_pointer:
for line in file_pointer:
if line.strip() and not line.strip().startswith('#'):
requirements.append(line.strip())
return requirements
def add_per_version_requirements():
extra_requires_dict = {}
for current_file in os.listdir(REQ_DIR or '.'): # the '.' allows tox to be run locally
if not current_file.startswith('requirements-') or 'docs' in current_file and 'dev' not in current_file:
continue
python_version = current_file[len('requirements-'):-len('.txt')]
extra_requires_key = ':python_version == "{}"'.format(python_version)
extra_requires_dict[extra_requires_key] = parse_requirements(current_file)
return extra_requires_dict
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
else:
params['install_requires'] = parse_requirements('requirements.txt')
params['test_suite'] = 'pytest'
params['extras_require'].update(add_per_version_requirements())
params['extras_require']['doc'] = parse_requirements('requirements-docs.txt')
params['extras_require']['dev'] = parse_requirements('requirements-dev.txt')
setup(**params)