forked from LibraryOfCongress/bagit-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
80 lines (65 loc) · 2.36 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, print_function
import glob
import os
import subprocess
import sys
from codecs import open
from setuptools import setup
if sys.version_info < (2, 7):
print("Python 2.7 or higher is required")
sys.exit(1)
description = "Create and validate BagIt packages"
with open("README.rst", encoding="utf-8") as readme:
long_description = readme.read()
tests_require = ["mock", "coverage"]
def get_message_catalogs():
message_catalogs = []
for po_file in glob.glob("locale/*/LC_MESSAGES/bagit-python.po"):
mo_file = po_file.replace(".po", ".mo")
if not os.path.exists(mo_file) or os.path.getmtime(mo_file) < os.path.getmtime(
po_file
):
try:
subprocess.check_call(["msgfmt", "-o", mo_file, po_file])
except (OSError, subprocess.CalledProcessError) as exc:
print(
"Translation catalog %s could not be compiled (is gettext installed?) "
" — translations will not be available for this language: %s"
% (po_file, exc),
file=sys.stderr,
)
continue
message_catalogs.append((os.path.dirname(mo_file), (mo_file,)))
return message_catalogs
setup(
name="bagit",
use_scm_version=True,
url="https://libraryofcongress.github.io/bagit-python/",
author="Ed Summers",
author_email="[email protected]",
py_modules=["bagit"],
scripts=["bagit.py"],
data_files=get_message_catalogs(),
description=description,
long_description=long_description,
platforms=["POSIX"],
test_suite="test",
setup_requires=["setuptools_scm"],
tests_require=tests_require,
classifiers=[
"License :: Public Domain",
"Intended Audience :: Developers",
"Topic :: Communications :: File Sharing",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Filesystems",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.1",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
],
)