|
7 | 7 | import os |
8 | 8 | import subprocess |
9 | 9 | import sys |
10 | | -from setuptools import setup |
11 | 10 | from codecs import open |
12 | 11 |
|
| 12 | +from setuptools import setup |
| 13 | + |
13 | 14 | if sys.version_info < (2, 7): |
14 | 15 | print("Python 2.7 or higher is required") |
15 | 16 | sys.exit(1) |
16 | 17 |
|
17 | | -description = 'Create and validate BagIt packages' |
| 18 | +description = "Create and validate BagIt packages" |
18 | 19 |
|
19 | 20 | with open("README.rst", encoding="utf-8") as readme: |
20 | 21 | long_description = readme.read() |
21 | 22 |
|
22 | | -tests_require = ['mock', 'coverage'] |
| 23 | +tests_require = ["mock", "coverage"] |
23 | 24 |
|
24 | 25 |
|
25 | 26 | def get_message_catalogs(): |
26 | 27 | message_catalogs = [] |
27 | 28 |
|
28 | | - for po_file in glob.glob('locale/*/LC_MESSAGES/bagit-python.po'): |
29 | | - mo_file = po_file.replace('.po', '.mo') |
| 29 | + for po_file in glob.glob("locale/*/LC_MESSAGES/bagit-python.po"): |
| 30 | + mo_file = po_file.replace(".po", ".mo") |
30 | 31 |
|
31 | | - if not os.path.exists(mo_file) or os.path.getmtime(mo_file) < os.path.getmtime(po_file): |
| 32 | + if not os.path.exists(mo_file) or os.path.getmtime(mo_file) < os.path.getmtime( |
| 33 | + po_file |
| 34 | + ): |
32 | 35 | try: |
33 | | - subprocess.check_call(['msgfmt', '-o', mo_file, po_file]) |
| 36 | + subprocess.check_call(["msgfmt", "-o", mo_file, po_file]) |
34 | 37 | except (OSError, subprocess.CalledProcessError) as exc: |
35 | | - print("Translation catalog %s could not be compiled (is gettext installed?) " |
36 | | - " — translations will not be available for this language: %s" % (po_file, exc), |
37 | | - file=sys.stderr) |
| 38 | + print( |
| 39 | + "Translation catalog %s could not be compiled (is gettext installed?) " |
| 40 | + " — translations will not be available for this language: %s" |
| 41 | + % (po_file, exc), |
| 42 | + file=sys.stderr, |
| 43 | + ) |
38 | 44 | continue |
39 | 45 |
|
40 | | - message_catalogs.append((os.path.dirname(mo_file), (mo_file, ))) |
| 46 | + message_catalogs.append((os.path.dirname(mo_file), (mo_file,))) |
41 | 47 |
|
42 | 48 | return message_catalogs |
43 | 49 |
|
44 | 50 |
|
45 | 51 | setup( |
46 | | - name='bagit', |
| 52 | + name="bagit", |
47 | 53 | use_scm_version=True, |
48 | | - url='https://libraryofcongress.github.io/bagit-python/', |
49 | | - author='Ed Summers', |
50 | | - |
51 | | - py_modules=['bagit', ], |
52 | | - scripts=['bagit.py'], |
| 54 | + url="https://libraryofcongress.github.io/bagit-python/", |
| 55 | + author="Ed Summers", |
| 56 | + |
| 57 | + py_modules=["bagit"], |
| 58 | + scripts=["bagit.py"], |
53 | 59 | data_files=get_message_catalogs(), |
54 | 60 | description=description, |
55 | 61 | long_description=long_description, |
56 | | - platforms=['POSIX'], |
57 | | - test_suite='test', |
58 | | - setup_requires=['setuptools_scm'], |
| 62 | + platforms=["POSIX"], |
| 63 | + test_suite="test", |
| 64 | + setup_requires=["setuptools_scm"], |
59 | 65 | tests_require=tests_require, |
60 | 66 | classifiers=[ |
61 | | - 'License :: Public Domain', |
62 | | - 'Intended Audience :: Developers', |
63 | | - 'Topic :: Communications :: File Sharing', |
64 | | - 'Topic :: Software Development :: Libraries :: Python Modules', |
65 | | - 'Topic :: System :: Filesystems', |
66 | | - 'Programming Language :: Python :: 2.7', |
67 | | - 'Programming Language :: Python :: 3.1', |
68 | | - 'Programming Language :: Python :: 3.2', |
69 | | - 'Programming Language :: Python :: 3.3', |
70 | | - 'Programming Language :: Python :: 3.4', |
71 | | - 'Programming Language :: Python :: 3.5', |
72 | | - 'Programming Language :: Python :: 3.6', |
| 67 | + "License :: Public Domain", |
| 68 | + "Intended Audience :: Developers", |
| 69 | + "Topic :: Communications :: File Sharing", |
| 70 | + "Topic :: Software Development :: Libraries :: Python Modules", |
| 71 | + "Topic :: System :: Filesystems", |
| 72 | + "Programming Language :: Python :: 2.7", |
| 73 | + "Programming Language :: Python :: 3.1", |
| 74 | + "Programming Language :: Python :: 3.2", |
| 75 | + "Programming Language :: Python :: 3.3", |
| 76 | + "Programming Language :: Python :: 3.4", |
| 77 | + "Programming Language :: Python :: 3.5", |
| 78 | + "Programming Language :: Python :: 3.6", |
73 | 79 | ], |
74 | 80 | ) |
0 commit comments