This repository has been archived by the owner on Feb 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
62 lines (49 loc) · 2.12 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
# -*- coding: utf-8 -*-
import subprocess
import sys
from distutils import log
from distutils.command.build_py import build_py
from distutils.dep_util import newer
from setuptools import find_packages, setup
from fuuk import __version__
PACKAGE_DATA = {'fuuk': ['locale/cs/LC_MESSAGES/*', 'templates/*.html', 'templates/admin/*',
'templates/flatpages/*.html', 'templates/magnet/*.html',
'templates/ofb/*.html', 'templates/oppo/*.html', 'templates/oppo/people/*.html',
'templates/oppo/people/person/*.html',
'templates/people/*.html', 'templates/people/person/*.html', 'templates/theory/*.html'],
'fuuk.people': ['fixtures/*.yaml', 'static/css/*', 'static/img/*', 'static/js/*']}
def get_requirements(filename):
return open(filename).read().splitlines()
class i18n_build_py(build_py):
"""
Distuutils `build_py` command which compiles also gettext files.
"""
def byte_compile(self, files):
build_py.byte_compile(self, files)
# Skip compiling
if sys.dont_write_bytecode:
return
for pofile in files:
if pofile[-3:] != ".po":
# Don't compile anything else
continue
mofile = pofile[:-3] + '.mo'
if self.force or newer(pofile, mofile):
log.info("byte-compiling %s to %s", pofile, mofile)
if not self.dry_run:
subprocess.check_call(['msgfmt', '-o', mofile, pofile])
else:
log.debug("skipping byte-compilation of %s to %s",
pofile, mofile)
def main():
setup(name='fuuk',
version=__version__,
author='Vlastimil Zíma',
author_email='vlastimil.zima@gmail.com',
description='Web of Institute of Physics at Charles University',
packages=find_packages(exclude=('settings', )),
package_data=PACKAGE_DATA,
install_requires=get_requirements('requirements.txt'),
cmdclass={'build_py': i18n_build_py})
if __name__ == '__main__':
main()