Commits

Anonymous committed cdecfba

initial import of Michael's code

  • Participants

Comments (0)

Files changed (2)

+#! /usr/bin/env python
+
+# Public domain
+# Idea from Georg Brandl. Foolishly implemented by Michael Foord
+# E-mail: fuzzyman AT voidspace DOT org DOT uk
+
+import sys
+
+
+def execute(arg):
+    exec (compile(arg, '<cmdline>', 'single'))
+
+def main(args):
+    if not args:
+        print ('Idea from Georg Brandl. Foolishly implemented by Michael Foord')
+        sys.exit()
+
+    first = args[0]
+    try:
+        execute(first)
+    except NameError:
+        try:
+            __import__(first)
+        except ImportError:
+            # easy way to re-raise the original error
+            execute(first)
+        else:
+            try:
+                mod = sys.modules[first]
+            except KeyError:
+                print ('%s is not a valid module name' % first)
+                sys.exit(1)
+        
+            location = getattr(mod, '__file__', 'None')
+            if location.endswith('.pyc'):
+                location = location[:-1]
+            print (location)
+
+    for x in args[1:]:
+       execute(x)
+
+
+if __name__ == '__main__':
+    main(sys.argv[1:])
+#! /usr/bin/env python
+# -*- encoding: utf8 -*-
+
+from distutils.core import setup
+
+# perform the setup action
+setup(
+    name="e",
+    version='1.1',
+    description=u"python -me",
+    author="Georg Brandl, Michael Foord and Richard Jones",
+    author_email="richard@python.org",
+    scripts=['e.py'],
+)
+
+# vim: set filetype=python ts=4 sw=4 et si