-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
89 lines (74 loc) · 3.15 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
#!/usr/bin/env python
"""
setup.py file for afnumpy
"""
from setuptools import setup
import setuptools.command.build_py
import subprocess
import os.path
version = '1.3'
name = 'afnumpy'
cwd = os.path.dirname(os.path.abspath(__file__))
def _get_version_hash():
"""Talk to git and find out the tag/hash of our latest commit"""
try:
p = subprocess.Popen(["git", "rev-parse", "--short" ,"HEAD"],
stdout=subprocess.PIPE)
except EnvironmentError:
print("Couldn't run git to get a version number for setup.py")
return
ver = p.communicate()[0]
return ver.strip().decode("utf-8")
git_hash = _get_version_hash()
# Get the long description from the README file
with open(os.path.join(cwd, 'README.md')) as f:
long_description = f.read()
long_description += "\n### Git commit\n[%s](http://github.com/FilipeMaia/afnumpy/commit/%s)" % (git_hash,git_hash)
class Version(setuptools.command.build_py.build_py):
def run(self):
self.create_version_file()
setuptools.command.build_py.build_py.run(self)
def create_version_file(self):
print('-- Building version ' + version)
version_path = os.path.join(cwd, name, 'version.py')
with open(version_path, 'w') as f:
f.write("__version__ = '%s'\n" % (version))
f.write("__githash__ = '%s'\n" % (git_hash))
setup (name = name,
version = version,
author = "Filipe Maia",
author_email = "filipe.c.maia@gmail.com",
url = 'https://github.com/FilipeMaia/afnumpy',
download_url = 'https://github.com/FilipeMaia/afnumpy/archive/'+version+'.tar.gz',
keywords = ['arrayfire', 'numpy', 'GPU'],
description = """A GPU-ready drop-in replacement for numpy""",
long_description= long_description,
long_description_content_type='text/markdown',
packages = ["afnumpy", "afnumpy/core", "afnumpy/lib", "afnumpy/linalg", "afnumpy/sparse"],
install_requires=['arrayfire', 'numpy>=1.9.0'],
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
# Indicate who your project is intended for
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Physics',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: BSD License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
#'Programming Language :: Python :: 3',
#'Programming Language :: Python :: 3.2',
#'Programming Language :: Python :: 3.3',
#'Programming Language :: Python :: 3.4',
],
license='BSD',
cmdclass={"build_py": Version},
tests_require=['pytest','pytest-cov','pytest-benchmark','arrayfire','numpy>=1.9.0'],
setup_requires=["pytest-runner"],
)