-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
455 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,68 +7,74 @@ | |
import os | ||
import subprocess | ||
import sys | ||
from setuptools import setup | ||
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' | ||
description = "Create and validate BagIt packages" | ||
|
||
with open("README.rst", encoding="utf-8") as readme: | ||
long_description = readme.read() | ||
|
||
tests_require = ['mock', 'coverage'] | ||
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') | ||
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): | ||
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]) | ||
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) | ||
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, ))) | ||
message_catalogs.append((os.path.dirname(mo_file), (mo_file,))) | ||
|
||
return message_catalogs | ||
|
||
|
||
setup( | ||
name='bagit', | ||
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'], | ||
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'], | ||
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', | ||
"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", | ||
], | ||
) |
Oops, something went wrong.