From: Frank Brehm Date: Wed, 8 Dec 2021 17:34:24 +0000 (+0100) Subject: Make setup.py successful X-Git-Tag: 0.4.1~4^2~52 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=de5529bd61fd6dc2bf4cec01f63d9373747954bd;p=pixelpark%2Fpp-admin-tools.git Make setup.py successful --- diff --git a/.gitignore b/.gitignore index 1862afa..47af2be 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ MANIFEST tmp/* .bundle/ vendor/ +build/ +dist/ +.egg* diff --git a/lib/pp_admintools/locale b/lib/pp_admintools/locale new file mode 120000 index 0000000..853389b --- /dev/null +++ b/lib/pp_admintools/locale @@ -0,0 +1 @@ +../../locale \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index d42e94e..eee552f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,3 +61,4 @@ max-line-length = 99 max-complexity = 20 ignore = E226,E302,E41,E402 +# vim: filetype=dosini diff --git a/setup.py b/setup.py index ec5fb62..a3eb47d 100644 --- a/setup.py +++ b/setup.py @@ -79,16 +79,8 @@ if sys.version_info[0] >= 3: # ----------------------------------- def read(fname): - content = None - - if sys.version_info[0] < 3: - with open(fname, 'r') as fh: - content = fh.read() - else: - with open(fname, 'r', **__open_args__) as fh: - content = fh.read() - - return content + f = Path(fname) + return f.read_text() # ----------------------------------- @@ -113,7 +105,7 @@ def read_requirements(): if not req_file.is_file(): return - f_content = req_file.read() + f_content = req_file.read_text() if not f_content: return @@ -135,33 +127,39 @@ def read_requirements(): if module not in __requirements__: __requirements__.append(module) - # print("Found required modules: {}\n".format(pp(__requirements__))) - read_requirements() +# print("Found required modules:\n" + pp(__requirements__) + '\n') + # ----------------------------------- __scripts__ = [ 'bin/dns-deploy-zones' ] +# print("Given scripts:\n" + pp(__scripts__) + "\n") + # ----------------------------------- __data_files__ = [] -__scripts__ = [] +__admin_scripts__ = [] -__data_files__.append(('etc/pixelpark', 'etc/dns-deploy-zones.ini.default')) +__data_files__.append(('etc/pixelpark', ['etc/dns-deploy-zones.ini.default'])) for f in __script_dir__.glob('*'): - if f.is_file() and os.access(str(f), os.X_OK): + if f.is_file(): relpath = os.path.relpath(str(f), str(__base_dir__)) - __scripts__.append(relpath) -if __scripts__: - __data_files__.append(('usr/libexec/pixelpark', __scripts__)) + __admin_scripts__.append(relpath) +if __admin_scripts__: + __data_files__.append(('usr/libexec/pixelpark', __admin_scripts__)) + +# print("Found data files:\n" + pp(__data_files__) + "\n") # ----------------------------------- -MO_FILES = 'locale/*/LC_MESSAGES/*.mo' +# MO_FILES = 'locale/*/LC_MESSAGES/*.mo' PO_FILES = 'locale/*/LC_MESSAGES/*.po' +__package_data__ = {} + def create_mo_files(): mo_files = [] for po_path in glob.glob(PO_FILES): @@ -172,10 +170,13 @@ def create_mo_files(): subprocess.call(['msgfmt', '-o', str(mo), po_path]) mo_files.append(str(mo)) - # print("Found mo files: {}\n".format(pp(mo_files))) + # print("Found mo files:\n" + pp(mo_files) + '\n') return mo_files +__package_data__[''] = create_mo_files() +# print("Package_data:\n" + pp(__package_data__) + "\n") + # ----------------------------------- setup( version=__packet_version__, @@ -183,9 +184,7 @@ setup( scripts=__scripts__, requires=__requirements__, package_dir={'': 'lib'}, - package_data={ - '': create_mo_files(), - }, + package_data=__package_data__, data_files=__data_files__, )