Insert lib/spack/external into sys.path. This avoids cases where the system
python install and lib/spack/external have the same library installed. This requires modifying the names of some modules in lib/spack/external in cases where both the system python and backported features of future python versions (i.e. after 2.6) are used (previously distinguished by "from external import X" and "import X").
This commit is contained in:
parent
9474b8cdac
commit
6d7b26d4e0
43 changed files with 46 additions and 44 deletions
|
@ -38,6 +38,8 @@ SPACK_PREFIX = os.path.dirname(os.path.dirname(SPACK_FILE))
|
|||
# Allow spack libs to be imported in our scripts
|
||||
SPACK_LIB_PATH = os.path.join(SPACK_PREFIX, "lib", "spack")
|
||||
sys.path.insert(0, SPACK_LIB_PATH)
|
||||
SPACK_EXTERNAL_LIBS = os.path.join(SPACK_LIB_PATH, "external")
|
||||
sys.path.insert(0, SPACK_EXTERNAL_LIBS)
|
||||
|
||||
# If there is no working directory, use the spack prefix.
|
||||
try:
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import llnl.util.tty as tty
|
||||
import spack
|
||||
import spack.cmd
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
##############################################################################
|
||||
import os
|
||||
import re
|
||||
from external import argparse
|
||||
import argparse
|
||||
import hashlib
|
||||
from pprint import pprint
|
||||
from subprocess import CalledProcessError
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.tty.color import colorize
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
import sys
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
import hashlib
|
||||
import re
|
||||
|
||||
from external.ordereddict import OrderedDict
|
||||
from ordereddict_backport import OrderedDict
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import mkdirp
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import llnl.util.tty as tty
|
||||
|
||||
import spack
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
##############################################################################
|
||||
import sys
|
||||
import os
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
import os
|
||||
from external import argparse
|
||||
import argparse
|
||||
import llnl.util.tty as tty
|
||||
import spack.cmd
|
||||
import spack.build_environment as build_env
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
import sys
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.tty.colify import colify
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import spack
|
||||
import spack.cmd
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
import sys
|
||||
import collections
|
||||
import itertools
|
||||
from external import argparse
|
||||
import argparse
|
||||
from StringIO import StringIO
|
||||
|
||||
import llnl.util.tty as tty
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import spack
|
||||
import spack.cmd
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
##############################################################################
|
||||
import sys
|
||||
import llnl.util.tty as tty
|
||||
from external import argparse
|
||||
import argparse
|
||||
from llnl.util.tty.colify import colify
|
||||
|
||||
import spack
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import spack.modules
|
||||
|
||||
description ="Add package to environment using modules."
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
##############################################################################
|
||||
import os
|
||||
import sys
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import join_path
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
##############################################################################
|
||||
import os
|
||||
import hashlib
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import *
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
from external import argparse
|
||||
import argparse
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.tty.colify import colify
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
import sys
|
||||
import os
|
||||
import shutil
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.lang import partition_list
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import spack.cmd
|
||||
import spack
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
##############################################################################
|
||||
import os
|
||||
|
||||
from external import argparse
|
||||
import argparse
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.tty.colify import colify
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
import os
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
from llnl.util.tty.colify import colify
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
import os
|
||||
import sys
|
||||
import code
|
||||
from external import argparse
|
||||
import argparse
|
||||
import platform
|
||||
|
||||
import spack
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import spack
|
||||
|
||||
description = "Rebuild Spack's package database."
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import spack.cmd
|
||||
|
||||
import llnl.util.tty as tty
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
import os
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
import spack
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import xml.etree.ElementTree as ET
|
||||
import itertools
|
||||
import re
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
import sys
|
||||
from external import argparse
|
||||
import argparse
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.tty.colify import colify
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import spack.modules
|
||||
|
||||
description ="Remove package from environment using module."
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import spack.modules
|
||||
|
||||
description ="Remove package from environment using dotkit."
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from external import argparse
|
||||
import argparse
|
||||
import spack.modules
|
||||
|
||||
description ="Add package to environment using dotkit."
|
||||
|
|
|
@ -90,12 +90,12 @@
|
|||
import exceptions
|
||||
import sys
|
||||
|
||||
from external.ordereddict import OrderedDict
|
||||
from ordereddict_backport import OrderedDict
|
||||
from llnl.util.lang import memoized
|
||||
import spack.error
|
||||
|
||||
from external import yaml
|
||||
from external.yaml.error import MarkedYAMLError
|
||||
import yaml
|
||||
from yaml.error import MarkedYAMLError
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import mkdirp
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
import time
|
||||
import socket
|
||||
|
||||
from external import yaml
|
||||
from external.yaml.error import MarkedYAMLError, YAMLError
|
||||
import yaml
|
||||
from yaml.error import MarkedYAMLError, YAMLError
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import *
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
import shutil
|
||||
import glob
|
||||
import tempfile
|
||||
from external import yaml
|
||||
import yaml
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import join_path, mkdirp
|
||||
|
|
|
@ -96,8 +96,8 @@
|
|||
import base64
|
||||
from StringIO import StringIO
|
||||
from operator import attrgetter
|
||||
from external import yaml
|
||||
from external.yaml.error import MarkedYAMLError
|
||||
import yaml
|
||||
from yaml.error import MarkedYAMLError
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.lang import *
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
import llnl.util.tty as tty
|
||||
|
||||
from external import pyqver2
|
||||
import pyqver2
|
||||
import spack
|
||||
|
||||
spack_max_version = (2,6)
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
import re
|
||||
from bisect import bisect_left
|
||||
from functools import wraps
|
||||
from external.functools import total_ordering
|
||||
from functools_backport import total_ordering
|
||||
|
||||
# Valid version characters
|
||||
VALID_VERSION = r'[A-Za-z0-9_.-]'
|
||||
|
|
Loading…
Reference in a new issue