def clean_build(tmpdir='.tmpdir'):
    """
    do a clean build of the module in folder tmpdir

    Parameters
    ----------

    tmpdir: str
       name of directory for the install target
    
    Returns:
       None -- builds module as side effect
    """
    #
    #
    #
    try:
        shutil.rmtree(tmpdir)
    except FileNotFoundError:
         pass
    command=f"python -m pip -v install --target={tmpdir} --no-deps --ignore-installed .".split()
    out=subprocess.check_output(command,stderr=subprocess.STDOUT,universal_newlines=True)
    the_path= Path(f'{tmpdir}').resolve()
    sys.path.insert(0, str(the_path))
    site.removeduppaths()
    print(out)
 def test_no_duplicate_paths(self):
     # No duplicate paths should exist in sys.path
     # Handled by removeduppaths()
     site.removeduppaths()
     seen_paths = set()
     for path in sys.path:
         self.assertNotIn(path, seen_paths)
         seen_paths.add(path)
Exemple #3
0
 def test_no_duplicate_paths(self):
     # No duplicate paths should exist in sys.path
     # Handled by removeduppaths()
     site.removeduppaths()
     seen_paths = set()
     for path in sys.path:
         self.assertNotIn(path, seen_paths)
         seen_paths.add(path)
Exemple #4
0
 def test_no_duplicate_paths(self):
     # No duplicate paths should exist in sys.path
     # Handled by removeduppaths()
     site.removeduppaths()
     seen_paths = set()
     for path in sys.path:
         self.failUnless(path not in seen_paths)
         seen_paths.add(path)
Exemple #5
0
 def test_no_duplicate_paths(self):
     # No duplicate paths should exist in sys.path
     # Handled by removeduppaths()
     site.removeduppaths()
     seen_paths = set()
     for path in sys.path:
         self.failUnless(path not in seen_paths)
         seen_paths.add(path)
Exemple #6
0
def add_path():
    """
    find the full path to the directory above this one and
    add it to sys.path so we can import local modules 
    """
    the_path = Path('..').resolve()
    print(f'adding {the_path} to sys.path')
    sys.path.insert(0, str(the_path))
    site.removeduppaths()
Exemple #7
0
from pathlib import Path
import sys
import site
root_dir = Path().parent.resolve()
print('top ',root_dir)
sys.path.insert(0, str(root_dir))
site.removeduppaths()

from a500.thermo.thermfuncs import testitA, testitB

testitA()

testitB()
 def test_no_duplicate_paths(self):
     site.removeduppaths()
     seen_paths = set()
     for path in sys.path:
         self.assertNotIn(path, seen_paths)
         seen_paths.add(path)
Exemple #9
0
 def update_event(self, inp=-1):
     self.set_output_val(0, site.removeduppaths())
Exemple #10
0
import sys
import site
import os

try:
    getusersitepackages = site.getusersitepackages
except AttributeError:
    # Probably virtualenv. Don't do anything
    pass
else:
    old_user_site = getusersitepackages()
    site.USER_BASE = os.environ.get("PYTHONUSERBASE", "/var/data/python")
    site.USER_SITE = None
    site.USER_SITE = getusersitepackages()
    sys.path = [
        item for item in sys.path if not item.startswith(old_user_site)
    ]
    site.addusersitepackages(site.removeduppaths())