# -----------------------------------
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()
# -----------------------------------
if not req_file.is_file():
return
- f_content = req_file.read()
+ f_content = req_file.read_text()
if not f_content:
return
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):
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__,
scripts=__scripts__,
requires=__requirements__,
package_dir={'': 'lib'},
- package_data={
- '': create_mo_files(),
- },
+ package_data=__package_data__,
data_files=__data_files__,
)