fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Python 3.4-3.7 support;
[librarian.git]
/
scripts
/
book2partner
diff --git
a/scripts/book2partner
b/scripts/book2partner
index
3534d2a
..
8982354
100755
(executable)
--- a/
scripts/book2partner
+++ b/
scripts/book2partner
@@
-4,18
+4,15
@@
# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
+from __future__ import print_function, unicode_literals
+
+from collections import OrderedDict
import inspect
import optparse
import inspect
import optparse
+import os
+import sys
from librarian import packagers
from librarian import packagers
-try:
- from collections import OrderedDict
-except ImportError:
- try:
- from django.utils.datastructures import SortedDict
- OrderedDict = SortedDict
- except ImportError:
- OrderedDict = dict
if __name__ == '__main__':
if __name__ == '__main__':
@@
-52,6
+49,7
@@
if __name__ == '__main__':
options, input_filenames = parser.parse_args()
packages = OrderedDict()
options, input_filenames = parser.parse_args()
packages = OrderedDict()
+ sys.path.insert(0, os.getcwd())
for module_name in options.packages_modules.split(','):
if not module_name:
continue
for module_name in options.packages_modules.split(','):
if not module_name:
continue
@@
-61,12
+59,12
@@
if __name__ == '__main__':
if inspect.isclass(package) and issubclass(package, packagers.Packager):
packages[package_name] = package
if not packages:
if inspect.isclass(package) and issubclass(package, packagers.Packager):
packages[package_name] = package
if not packages:
- print
'No packages found!'
+ print
('No packages found!')
if options.list_packages:
if options.list_packages:
- print
'Available packages:'
+ print
('Available packages:')
for package_name, package in packages.items():
for package_name, package in packages.items():
- print
' ', package_name
+ print
(' ', package_name)
exit(0)
if len(input_filenames) < 1 or not options.packages:
exit(0)
if len(input_filenames) < 1 or not options.packages:
@@
-76,6
+74,6
@@
if __name__ == '__main__':
used_packages = [packages[p] for p in options.packages.split(',')]
for package in used_packages:
if options.verbose:
used_packages = [packages[p] for p in options.packages.split(',')]
for package in used_packages:
if options.verbose:
- print
'Package:', package.__name__
+ print
('Package:', package.__name__)
package.prepare(input_filenames,
options.output_dir, options.verbose, options.overwrite)
package.prepare(input_filenames,
options.output_dir, options.verbose, options.overwrite)