[cig-commits] r4749 - cs/pythia/trunk/pythia
leif at geodynamics.org
leif at geodynamics.org
Mon Oct 9 05:12:10 PDT 2006
Author: leif
Date: 2006-10-09 05:12:10 -0700 (Mon, 09 Oct 2006)
New Revision: 4749
Added:
cs/pythia/trunk/pythia/__init__.py
Log:
Fix-up sys.path so that e.g., "import pyre" works.
In the application, a single "import pythia" is needed
somewhere (e.g., Foo/__init__.py, or the top-level script).
If this were C++, "import pythia" would be equivalent to
using namespace pythia;
It would be nice if pkg_resources provided an API for
this:
from pkg_resources import use
use('pythia', __name__)
Or maybe a language extension? :-)
The difference being that this would modify __path__
instead of sys.path for modules. At least, I think that
would work. I tried to tweak e.g., pyre.__path__ from
within pythia, but it lead to an infinite regress no
matter how I did it. It might require a custom loader
(Pmw has one), I'm not sure.
Added: cs/pythia/trunk/pythia/__init__.py
===================================================================
--- cs/pythia/trunk/pythia/__init__.py 2006-10-09 04:29:55 UTC (rev 4748)
+++ cs/pythia/trunk/pythia/__init__.py 2006-10-09 12:12:10 UTC (rev 4749)
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# California Institute of Technology
+# (C) 2006 All Rights Reserved
+#
+# {LicenseText}
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+import sys
+sys.path.append(__path__[0])
+
+
+# end of file
More information about the cig-commits
mailing list