This repository was archived by the owner on Jan 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
128 lines (113 loc) · 5.13 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# python setup.py sdist --formats=gztar,zip bdist --formats=rpm,wininst
# sudo python setup.py register -r https://testpypi.python.org/pypi sdist --formats=gztar bdist --formats=egg upload -r https://testpypi.python.org/pypi
# sudo python setup.py check build_sphinx --source-dir=savReaderWriter/documentation -v
# sudo python setup.py check upload_sphinx --upload-dir=build/sphinx/html
import os
import sys
import platform
path = os.path.dirname(os.path.realpath(__file__)) or os.getcwd()
sys.path.insert(0, path)
try:
from ez_setup import use_setuptools
use_setuptools()
except:
pass # Tox
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read().strip()
#####
## Set package_data values, depending on install/build
#####
is_32bit = platform.architecture()[0] == "32bit"
is_64bit = platform.architecture()[0] == "64bit"
is_install_mode = 'install' in sys.argv
pf = sys.platform.lower()
## This is included in every platform
package_data = {'savReaderWriter': ['spssio/include/*.*',
'spssio/documents/*',
'spssio/license/*',
'cWriterow/*.*',
'documentation/*.*',
'doc_tests/*.*',
'test_data/*.*',
'README','VERSION',
'TODO', 'COPYRIGHT']}
## *installing* the package: install only platform-relevant libraries
if is_install_mode:
if pf.startswith("win") and is_32bit:
package_data['savReaderWriter'].append('spssio/win32/*.*')
elif pf.startswith("win"):
package_data['savReaderWriter'].append('spssio/win64/*.*')
elif pf.startswith("lin") and is_32bit:
package_data['savReaderWriter'].append('spssio/lin32/*.*')
elif pf.startswith("lin") and is_64bit and os.uname()[-1] == "s390x":
package_data['savReaderWriter'].append('spssio/zlinux64/*.*')
elif pf.startswith("lin") and is_64bit:
package_data['savReaderWriter'].append('spssio/lin64/*.*')
elif pf.startswith("darwin") or pf.startswith("mac"):
package_data['savReaderWriter'].append('spssio/macos/*.*')
elif pf.startswith("aix") and not is_32bit:
package_data['savReaderWriter'].append('spssio/aix64/*.*')
elif pf.startswith("hp-ux"):
package_data['savReaderWriter'].append('spssio/hp-ux/*.*')
elif pf.startswith("sunos") and not is_32bit:
package_data['savReaderWriter'].append('spssio/sol64/*.*')
else:
msg = "Your platform (%r) is not supported" % pf
raise NotImplementedError(msg)
## *building* the package: include all the libraries
else:
package_data['savReaderWriter'].extend(['spssio/win32/*.*',
'spssio/win64/*.*',
'spssio/lin32/*.*',
'spssio/zlinux64/*.*',
'spssio/lin64/*.*',
'spssio/macos/*.*',
'spssio/aix64/*.*'
'spssio/hpux_it/*.*',
'spssio/sol64/*.*'])
email = "@".join(["fomcl", "yahoo.com"])
setup(name='savReaderWriter',
version=read('VERSION'),
description='Read and write SPSS files',
author='Albert-Jan Roskam',
author_email=email,
maintainer='Albert-Jan Roskam',
maintainer_email=email,
license='MIT',
long_description=read('README'),
zip_safe=False,
platforms=['Windows', 'Mac', 'Linux/POSIX'],
url='https://bitbucket.org/fomcl/savreaderwriter',
download_url='https://bitbucket.org/fomcl/savreaderwriter/downloads',
extras_require={'fastReading': ["psyco"],
'arraySlicing': ["numpy"],
'fastWriting': ["Cython"],},
packages=['savReaderWriter'],
package_data=package_data,
classifiers=['Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Cython',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Database']
)
# ugly, but it works
# for f in ['README','VERSION', 'TODO', 'COPYRIGHT']:
# p = os.path.dirname(__file__)
# src = os.path.join(p, f)
# dst = os.path.join(p, "savReaderWriter", f)
# shutil.copy(src, dst)
with open(os.path.join(path, "savReaderWriter", "SHA1VERSION"), "wb") as f:
try:
import sha1version
f.write(sha1version.getHEADhash())
except:
f.write(b"--UNKNOWN--")