summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-07-10 15:52:24 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-08-11 22:47:22 -0700
commit113afe860ecea247c5ed343b814a633565c2033b (patch)
tree5522f698da9df0eafd1b1ead2b27f52c98dc1f50
parent884a4fecd18eb983ae02ead366d638a735e5170b (diff)
downloadspack-113afe860ecea247c5ed343b814a633565c2033b.tar.gz
spack-113afe860ecea247c5ed343b814a633565c2033b.tar.bz2
spack-113afe860ecea247c5ed343b814a633565c2033b.tar.xz
spack-113afe860ecea247c5ed343b814a633565c2033b.zip
More robust symbol inclusion for 'from spack import *'
- avoid errors where some symbols aren't exported to packages. - reduce the number of places each symbol needs to be mentioned in an __all__ list
-rw-r--r--lib/spack/spack/__init__.py41
1 files changed, 23 insertions, 18 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 9eae4342e3..a3f00a11b1 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -22,20 +22,6 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
-
-#
-# When packages call 'from spack import *', this is what is brought in.
-#
-# Spack internal code calls 'import spack' and accesses other
-# variables (spack.db, paths, etc.) directly.
-#
-# TODO: maybe this should be separated out and should go in build_environment.py?
-# TODO: it's not clear where all the stuff that needs to be included in packages
-# should live. This file is overloaded for spack core vs. for packages.
-__all__ = ['Package', 'when', 'provides', 'depends_on', 'version',
- 'patch', 'Version', 'working_dir', 'which', 'Executable',
- 'filter_file', 'change_sed_delimiter']
-
import os
import tempfile
from llnl.util.filesystem import *
@@ -141,11 +127,30 @@ do_checksum = True
#
sys_type = None
+
+#
+# When packages call 'from spack import *', this extra stuff is brought in.
+#
+# Spack internal code should call 'import spack' and accesses other
+# variables (spack.db, paths, etc.) directly.
#
-# Extra imports that should be generally usable from package.py files.
+# TODO: maybe this should be separated out and should go in build_environment.py?
+# TODO: it's not clear where all the stuff that needs to be included in packages
+# should live. This file is overloaded for spack core vs. for packages.
#
-from llnl.util.filesystem import working_dir
+__all__ = ['Package', 'Version', 'when']
from spack.package import Package
-from spack.relations import *
-from spack.multimethod import when
from spack.version import Version
+from spack.multimethod import when
+
+import llnl.util.filesystem
+from llnl.util.filesystem import *
+__all__ += llnl.util.filesystem.__all__
+
+import spack.relations
+from spack.relations import *
+__all__ += spack.relations.__all__
+
+import spack.util.executable
+from spack.util.executable import *
+__all__ += spack.util.executable.__all__