Skip to content

Commit cafcd31

Browse files
committed
add setup.py
1 parent f629e2e commit cafcd31

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
__pycache__/
2+
/dist/
3+
/sdkmanager.egg-info/

setup.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[metadata]
2+
license_file = LICENSE
3+
4+
# uploading here requires Python 3.5.3+ or setuptools 27+,
5+
# use instead: twine upload --sign dist/fdroidserver*.tar.gz
6+
[aliases]
7+
release = versioncheck sdist

setup.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env python3
2+
3+
from setuptools import Command
4+
from setuptools import setup
5+
import subprocess
6+
import sys
7+
8+
9+
class VersionCheckCommand(Command):
10+
"""Make sure git tag and version match before uploading"""
11+
12+
user_options = []
13+
14+
def initialize_options(self):
15+
"""Abstract method that is required to be overwritten"""
16+
17+
def finalize_options(self):
18+
"""Abstract method that is required to be overwritten"""
19+
20+
def run(self):
21+
version = self.distribution.get_version()
22+
version_git = (
23+
subprocess.check_output(['git', 'describe', '--tags', '--always'])
24+
.rstrip()
25+
.decode('utf-8')
26+
)
27+
if version != version_git:
28+
print(
29+
'ERROR: Release version mismatch! setup.py (%s) does not match git (%s)'
30+
% (version, version_git)
31+
)
32+
sys.exit(1)
33+
print('Upload using: twine upload --sign dist/sdkmanager-%s.tar.gz' % version)
34+
35+
36+
with open("README.md", "r") as fh:
37+
long_description = fh.read()
38+
39+
setup(
40+
name='sdkmanager',
41+
version='0.1',
42+
description='Android SDK Manager',
43+
long_description=long_description,
44+
long_description_content_type='text/markdown',
45+
author='The F-Droid Project',
46+
author_email='[email protected]',
47+
url='https://f-droid.org',
48+
license='AGPL-3.0',
49+
scripts=['sdkmanager.py'],
50+
python_requires='>=3.5',
51+
cmdclass={'versioncheck': VersionCheckCommand},
52+
install_requires=[
53+
'argcomplete',
54+
'requests > 2.12.2, != 2.18.0',
55+
'requests-cache >= 0.4.13',
56+
],
57+
classifiers=[
58+
'Development Status :: 4 - Beta',
59+
'Intended Audience :: Developers',
60+
'Intended Audience :: Information Technology',
61+
'Intended Audience :: System Administrators',
62+
'Intended Audience :: Telecommunications Industry',
63+
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
64+
'Operating System :: POSIX',
65+
'Operating System :: MacOS :: MacOS X',
66+
'Operating System :: Unix',
67+
'Topic :: Utilities',
68+
],
69+
)

0 commit comments

Comments
 (0)