1 #! /usr/bin/env python3
7 from setuptools.command.install_lib import install_lib as _install_lib
8 from distutils.command.build import build as _build
9 from distutils.command.sdist import sdist as _sdist
10 from distutils.cmd import Command
11 from setuptools import setup, find_packages
16 if os.path.exists('VERSION'):
18 version = get_version()
19 with open('VERSION', 'w') as fd:
22 if os.path.exists('VERSION'):
27 if os.path.exists('VERSION'):
28 with open('VERSION', 'r') as v:
30 if os.path.exists('.git'):
31 p = subprocess.Popen(['git', 'describe', '--dirty=.dirty', '--match=v*'],
32 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
33 result = p.communicate()[0]
35 result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v
36 if '-' in result: # not a tagged version
37 real_number, commit_count, commit_hash = result.split('-', 2)
38 version = '%s.post%s+%s' % (real_number, commit_count, commit_hash)
43 return '0.0.post%s' % len(
44 subprocess.check_output(
45 ['git', 'rev-list', 'HEAD']).splitlines())
49 class compile_translations(Command):
50 description = 'compile message catalogs to MO files via django compilemessages'
53 def initialize_options(self):
56 def finalize_options(self):
61 from django.core.management import call_command
62 for path, dirs, files in os.walk('panikombo'):
63 if 'locale' not in dirs:
66 os.chdir(os.path.realpath(path))
67 call_command('compilemessages')
70 sys.stderr.write('!!! Please install Django to build translations\n')
74 sub_commands = [('compile_translations', None)] + _build.sub_commands
77 class install_lib(_install_lib):
79 self.run_command('compile_translations')
80 _install_lib.run(self)
85 version=get_version(),
86 description='Combo extensions for Radio Panik',
87 author='Frederic Peters',
88 author_email='fred@radiopanik.org',
89 packages=find_packages(),
90 include_package_data=True,
92 'Development Status :: 4 - Beta',
93 'Environment :: Web Environment',
94 'Framework :: Django',
95 'Intended Audience :: Developers',
96 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
97 'Operating System :: OS Independent',
98 'Programming Language :: Python',
99 'Programming Language :: Python :: 2',
100 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
101 'Topic :: Multimedia :: Sound/Audio',
106 'compile_translations': compile_translations,
107 'install_lib': install_lib,