aboutsummaryrefslogtreecommitdiffstats
path: root/x11-misc/mimeo/files
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-02-07 20:11:57 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2010-02-07 20:11:57 +0100
commit3c4b305871a4e83fc0995dc8701acbe8b0955b5c (patch)
tree9fbc6bca0b5d71d2b556956ab8ca59536aa260ef /x11-misc/mimeo/files
parent98043e09ca0a380c558fc69dc1a27a7c4e2317f3 (diff)
downloadoverlay-3c4b305871a4e83fc0995dc8701acbe8b0955b5c.tar.gz
overlay-3c4b305871a4e83fc0995dc8701acbe8b0955b5c.tar.xz
overlay-3c4b305871a4e83fc0995dc8701acbe8b0955b5c.zip
added mimeo package (easy file opening)
Diffstat (limited to 'x11-misc/mimeo/files')
-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()