aboutsummaryrefslogtreecommitdiffstats
path: root/x11-misc/mimeo/files
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--x11-misc/mimeo/files/__init__.py2
-rw-r--r--x11-misc/mimeo/files/mimeo37
-rw-r--r--x11-misc/mimeo/files/mimeo-2.65
3 files changed, 44 insertions, 0 deletions
diff --git a/x11-misc/mimeo/files/__init__.py b/x11-misc/mimeo/files/__init__.py
new file mode 100644
index 0000000..eae587c
--- /dev/null
+++ b/x11-misc/mimeo/files/__init__.py
@@ -0,0 +1,2 @@
+#!/usr/bin/env python
+from mimeo import main
diff --git a/x11-misc/mimeo/files/mimeo b/x11-misc/mimeo/files/mimeo
new file mode 100644
index 0000000..4c4fff4
--- /dev/null
+++ b/x11-misc/mimeo/files/mimeo
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+# Gentoo 'mimeo' wrapper script
+
+import os
+import re
+import subprocess
+import sys
+
+EPYTHON_re = re.compile(r"^python(\d+\.\d+)$")
+
+try:
+ eselect_process = subprocess.Popen(["/usr/bin/eselect", "python", "show", "--python2"], stdout=subprocess.PIPE)
+ if eselect_process.wait() != 0:
+ raise ValueError
+except (OSError, ValueError):
+ sys.stderr.write("Execution of 'eselect python show --python2' failed\n")
+ sys.exit(1)
+
+eselect_output = eselect_process.stdout.read()
+if not isinstance(eselect_output, str):
+ # Python 3
+ eselect_output = eselect_output.decode()
+
+EPYTHON_matched = EPYTHON_re.match(eselect_output)
+if EPYTHON_matched:
+ PYTHON_ABI = EPYTHON_matched.group(1)
+else:
+ sys.stderr.write("'eselect python show --python2' printed unrecognized value '%s" % eselect_output)
+ sys.exit(1)
+
+os.environ["PYTHON_PROCESS_NAME"] = sys.argv[0]
+target_executable = "%s-%s" % (os.path.realpath(sys.argv[0]), PYTHON_ABI)
+if not os.path.exists(target_executable):
+ sys.stderr.write("'%s' does not exist\n" % target_executable)
+ sys.exit(1)
+
+os.execv(target_executable, sys.argv)
diff --git a/x11-misc/mimeo/files/mimeo-2.6 b/x11-misc/mimeo/files/mimeo-2.6
new file mode 100644
index 0000000..5e86b20
--- /dev/null
+++ b/x11-misc/mimeo/files/mimeo-2.6
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+# Gentoo 'mimeo' wrapper script
+import mimeo
+
+mimeo.main()