-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
138 lines (117 loc) Β· 3.82 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# stolen from imgcat: https://github.com/wookayin/python-imgcat/blob/master/setup.py
import sys
import os
import re
from setuptools import setup, Command
with open("README.md", "r") as fh:
long_description = fh.read()
# setuptools.setup(
# name='gitlinks',
# version='0.2',
# author='Logan Engstrom',
# author_email='[email protected]',
# description='GitHub pages-powered shortlinks.',
# long_description=long_description,
# long_description_content_type="text/markdown",
# url='https://github.com/lengstrom/gitlinks',
# packages=setuptools.find_packages(),
# install_requires=[
# ],
# entry_points={
# 'console_scripts':['gitlinks=gitlinks.cli:main']
# },
# classifiers=[
# "Programming Language :: Python :: 3",
# "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
# "Operating System :: OS Independent",
# "Development Status :: 4 - Beta",
# "Environment :: Console"
# ],
# )
__PATH__ = os.path.abspath(os.path.dirname(__file__))
def read_readme():
with open('README.md') as f:
return f.read()
install_requires = [
'docopt>=0.6.2',
'GitPython>=3.1.13',
'ilock>=1.0.3',
'pandas>=1.2.2',
'portalocker>=2.2.1',
'requests>=2.25.1',
'requests-toolbelt>=0.9.1',
'tabulate>=0.8.9',
'tqdm>=4.58.0',
'twine'
]
tests_requires = [
'pytest<5.0'
]
__version__ = str(0.3)
# brought from https://github.com/kennethreitz/setup.py
class DeployCommand(Command):
description = 'Build and deploy the package to PyPI.'
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
@staticmethod
def status(s):
print(s)
def run(self):
import twine # we require twine locally
assert 'dev' not in __version__, \
"Only non-devel versions are allowed. __version__ == {}".format(__version__)
with os.popen("git status --short") as fp:
git_status = fp.read().strip()
if git_status:
print("Error: git repository is not clean.\n")
os.system("git status --short")
sys.exit(1)
try:
from shutil import rmtree
self.status('Removing previous builds ...')
rmtree(os.path.join(__PATH__, 'dist'))
except OSError:
pass
self.status('Building Source and Wheel (universal) distribution ...')
os.system('{0} setup.py sdist'.format(sys.executable))
self.status('Uploading the package to PyPI via Twine ...')
os.system('twine upload dist/*')
self.status('Creating git tags ...')
os.system('git tag v{0}'.format(__version__))
os.system('git tag --list')
sys.exit()
setup(
name='gitlinks',
version=__version__,
license='MIT',
description='GitHub pages-powered golinks',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/lengstrom/gitlinks',
author='Logan Engstrom',
author_email='[email protected]',
keywords='golinks github pages',
classifiers=[
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
packages=['gitlinks'],
install_requires=install_requires,
setup_requires=['pytest-runner<5.0'],
tests_require=tests_requires,
entry_points={
'console_scripts': ['gitlinks=gitlinks:main'],
},
include_package_data=True,
zip_safe=False,
cmdclass={
'deploy': DeployCommand,
},
python_requires=">=3.6")