3 from setuptools import Command
4 from setuptools import setup
11 class VersionCheckCommand(Command):
12 """Make sure git tag and version match before uploading"""
15 def initialize_options(self):
16 """Abstract method that is required to be overwritten"""
18 def finalize_options(self):
19 """Abstract method that is required to be overwritten"""
22 version = self.distribution.get_version()
23 version_git = subprocess.check_output(['git', 'describe', '--tags', '--always']).rstrip().decode('utf-8')
24 if version != version_git:
25 print('ERROR: Release version mismatch! setup.py (%s) does not match git (%s)'
26 % (version, version_git))
28 print('Upload using: twine upload dist/fdroidserver*.tar.gz*')
32 # workaround issue on OSX or --user installs, where sys.prefix is not an installable location
33 if os.access(sys.prefix, os.W_OK | os.X_OK):
34 data_prefix = sys.prefix
39 with open('MANIFEST.in') as fp:
42 data_files.append((data_prefix + '/share/doc/fdroidserver/examples',
43 ['buildserver/config.buildserver.py', ]
44 + re.findall(r'include (examples/.*)', data)))
46 for f in re.findall(r'include (locale/[a-z][a-z][a-zA-Z_]*/LC_MESSAGES/fdroidserver.mo)', data):
47 d = os.path.join(data_prefix, 'share', os.path.dirname(f))
48 data_files.append((d, [f, ]))
52 # PyPI accepts reST not Markdown
53 if os.path.exists('README.md'):
54 if shutil.which('pandoc'):
55 print('Using reST README')
57 subprocess.check_call(['pandoc', '--from=markdown', '--to=rst', 'README.md',
58 '--output=README.rst'], universal_newlines=True)
59 with open('README.rst') as fp:
62 print('Using Markdown README')
63 with open('README.md') as fp:
68 setup(name='fdroidserver',
70 description='F-Droid Server Tools',
71 long_description=readme,
72 author='The F-Droid Project',
73 author_email='team@f-droid.org',
74 url='https://f-droid.org',
76 packages=['fdroidserver', 'fdroidserver.asynchronousfilereader'],
77 scripts=['fdroid', 'makebuildserver'],
78 data_files=get_data_files(),
79 python_requires='>=3.4',
80 cmdclass={'versioncheck': VersionCheckCommand},
90 'apache-libcloud >= 0.14.1',
96 'ruamel.yaml >= 0.13',
97 'requests >= 2.5.2, != 2.11.0, != 2.12.2, != 2.18.0',
98 'docker-py >= 1.9, < 2.0',
101 'Development Status :: 4 - Beta',
102 'Intended Audience :: Developers',
103 'Intended Audience :: Information Technology',
104 'Intended Audience :: System Administrators',
105 'Intended Audience :: Telecommunications Industry',
106 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
107 'Operating System :: POSIX',
108 'Operating System :: MacOS :: MacOS X',
109 'Operating System :: Unix',
110 'Topic :: Utilities',