]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Make setup.py successful
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 8 Dec 2021 17:34:24 +0000 (18:34 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 8 Dec 2021 17:34:24 +0000 (18:34 +0100)
.gitignore
lib/pp_admintools/locale [new symlink]
setup.cfg
setup.py

index 1862afa96ac83db2c22da7dc1b0c3743b7ceccbc..47af2be46a513be52a0a98c4c32aaaab47014c41 100644 (file)
@@ -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 (symlink)
index 0000000..853389b
--- /dev/null
@@ -0,0 +1 @@
+../../locale
\ No newline at end of file
index d42e94e033ae263b6dc7ecdecdf24ac619e3d009..eee552f05a8aa1699c0746154fdf065c584e93e6 100644 (file)
--- 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
index ec5fb625ef0580dcdc037c725a588ca66c30f928..a3eb47d39d609380bb0274b0e5fcdf659f4e6cb1 100644 (file)
--- 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__,
 )