forked from mattpitkin/psrqpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
62 lines (51 loc) · 1.96 KB
/
Copy pathsetup.py
File metadata and controls
62 lines (51 loc) · 1.96 KB
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
# coding: utf-8
"""
A Python module for accessing the ATNF pulsar catalogue
"""
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
MAJOR, MINOR1, MINOR2, RELEASE, SERIAL = sys.version_info
READFILE_KWARGS = {"encoding": "utf-8"} if MAJOR >= 3 else {}
def readfile(filename):
with open(filename, **READFILE_KWARGS) as fp:
filecontents = fp.read()
return filecontents
VERSION_REGEX = re.compile("__version__ = \"(.*?)\"")
CONTENTS = readfile(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"psrqpy", "__init__.py"))
VERSION = VERSION_REGEX.findall(CONTENTS)[0]
# 'setup.py publish' shortcut for publishing (e.g. setup.py from requests https://github.com/requests/requests/blob/master/setup.py)
# 'setup.py publish' shortcut.
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist bdist_wheel --universal')
os.system('twine upload dist/*')
sys.exit()
if sys.argv[-1] == 'testpublish':
os.system('python setup.py sdist bdist_wheel --universal')
os.system('twine upload --repository-url https://test.pypi.org/legacy/ dist/*')
sys.exit()
setup(name="psrqpy",
version=VERSION,
author="Matthew Pitkin",
author_email="matthew.pitkin@glasgow.ac.uk",
packages=["psrqpy"],
url="http://www.github.com/mattpitkin/psrqpy/",
license="MIT",
description="A Python module for querying the ATNF pulsar catalogue",
long_description=\
readfile(os.path.join(os.path.dirname(__file__), "README.md")),
long_description_content_type="text/markdown",
install_requires=\
readfile(os.path.join(os.path.dirname(__file__), "requirements.txt")),
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7"])