+class build (_build):
+ def run (self):
+ _build.run (self)
+
+ def update_version ():
+ with open (os.path.join (self.build_scripts, "crypto-install"), "r+") as file:
+ data = file.read ()
+ data = re.sub ("GIT-TAG", check_output (["git", "describe", "--abbrev=0", "--tags"]).strip (), data)
+ data = re.sub ("GIT-COMMIT", check_output (["git", "rev-parse", "--short=7", "HEAD"]).strip (), data)
+ data = re.sub ("GIT-BRANCH", check_output (["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip (), data)
+ file.seek (0)
+ file.write (data)
+
+ self.execute (update_version, [], "Updating version")
+
+ def compile_message_catalog (translation, output):
+ check_call (["msgfmt", "-o", os.path.join (output, message_catalog (translation)), translation])
+
+ for translation in translations ():
+ output = os.path.join (self.build_base, os.path.dirname (translation))
+
+ self.mkpath (output)
+
+ self.execute (compile_message_catalog, [translation, output], "Compiling message catalog {}".format (translation))
+
+
+class install (_install):
+ def run (self):
+ _install.run (self)
+
+ self.copy_tree (os.path.join (self.build_base, "locale"),
+ os.path.join (self.install_data, "share/locale"))
+
+
+class clean (_clean):
+ def run (self):
+ _clean.run (self)
+
+ if os.path.exists (self.build_base):
+ remove_tree (self.build_base, dry_run = self.dry_run)
+
+
+setup (
+ name = "crypto_install",
+ version = "0.0.1",
+ author = "Olof-Joachim Frahm",
+ author_email = "olof@macrolet.net",
+ url = "https://github.com/Ferada/crypto-install",
+ scripts = ["crypto-install"],
+ install_requires = [],
+ tests_require = ["pytest"],
+ cmdclass = {
+ "build": build,
+ "clean": clean,
+ "test": test,
+ "install": install
+ },
+ classifiers = [
+ "Development Status :: 3 - Alpha",
+ "Environment :: Console",
+ "Environment :: X11 Applications",
+ "Intended Audience :: End Users/Desktop",
+ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
+ "Natural Language :: English",
+ "Natural Language :: German",
+ "Operating System :: POSIX",
+ "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 3.2",
+ "Topic :: Security :: Cryptography",
+ "Topic :: Utilities"
+ ])