chiark / gitweb /
remove fd-commit, no active devs use it, and requires Auto Name/Name
[fdroidserver.git] / setup.py
1 #!/usr/bin/env python3
2
3 from setuptools import Command
4 from setuptools import setup
5 import os
6 import re
7 import shutil
8 import sys
9
10
11 class VersionCheckCommand(Command):
12     """Make sure git tag and version match before uploading"""
13     user_options = []
14
15     def initialize_options(self):
16         """Abstract method that is required to be overwritten"""
17
18     def finalize_options(self):
19         """Abstract method that is required to be overwritten"""
20
21     def run(self):
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))
27             sys.exit(1)
28         print('Upload using: twine upload dist/fdroidserver*.tar.gz*')
29
30
31 def get_data_files():
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
35     else:
36         data_prefix = '.'
37
38     data_files = []
39     with open('MANIFEST.in') as fp:
40         data = fp.read()
41
42     data_files.append((data_prefix + '/share/doc/fdroidserver/examples',
43                        ['buildserver/config.buildserver.py', ]
44                        + re.findall(r'include (examples/.*)', data)))
45
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, ]))
49     return data_files
50
51
52 # PyPI accepts reST not Markdown
53 if os.path.exists('README.md'):
54     if shutil.which('pandoc'):
55         print('Using reST README')
56         import subprocess
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:
60             readme = fp.read()
61     else:
62         print('Using Markdown README')
63         with open('README.md') as fp:
64             readme = fp.read()
65 else:
66     readme = ''
67
68 setup(name='fdroidserver',
69       version='0.9.1',
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',
75       license='AGPL-3.0',
76       packages=['fdroidserver', 'fdroidserver.asynchronousfilereader'],
77       scripts=['fdroid', 'makebuildserver'],
78       data_files=get_data_files(),
79       python_requires='>=3.4',
80       cmdclass={'versioncheck': VersionCheckCommand},
81       setup_requires=[
82           'babel',
83       ],
84       install_requires=[
85           'clint',
86           'GitPython',
87           'mwclient',
88           'paramiko',
89           'Pillow',
90           'apache-libcloud >= 0.14.1',
91           'pyasn1',
92           'pyasn1-modules',
93           'python-vagrant',
94           'PyYAML',
95           'qrcode',
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',
99       ],
100       classifiers=[
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',
111       ],
112       )