-
Notifications
You must be signed in to change notification settings - Fork 83
/
setup.py
61 lines (49 loc) · 1.74 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
#!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, print_function
import glob
import os
import subprocess
import sys
from setuptools import setup
description = "Create and validate BagIt packages"
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,
platforms=["POSIX"],
setup_requires=["setuptools_scm"],
classifiers=[
"License :: Public Domain",
"Intended Audience :: Developers",
"Topic :: Communications :: File Sharing",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Filesystems",
"Programming Language :: Python :: 3",
],
)