Skip to content

Commit

Permalink
Uranium now runs in a separate sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed Jan 24, 2015
1 parent 6ab5238 commit 94c8ebf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scripts/uranium
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ def _install_uranium(virtualenv_dir, uranium_dir=None, version=None):
uranium_name = 'uranium=={0}'.format(version)

with open(log_file, 'w+') as fh:
#status = subprocess.call([pip_executable, 'install', uranium_name,
# '--upgrade'], stdout=fh, stderr=fh)
status = subprocess.call([pip_executable, 'install', uranium_name,
'--upgrade'], stdout=fh, stderr=fh)
'--upgrade'])
if status:
LOGGER.error("Unable to install uranium. please look at {0} for more info".format(
log_file
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
]

setup(name='uranium',
version='0.0.32',
version='0.0.36',
description='a build system for python',
long_description='a build system for python',
author='Yusuke Tsutsumi',
Expand Down
19 changes: 19 additions & 0 deletions uranium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,22 @@ def in_virtualenv(path):
# we end my making the virtualenv environment relocatable
make_environment_relocatable(path)

URANIUM_LIBS = [
'docopt',
'jinja2',
'pip',
'pyyaml',
'requests',
'setuptools',
'six',
'virtualenv',
'zc.buildout'
]

def _activate_virtualenv(uranium_dir):
""" this will activate a virtualenv in the case one exists """
sys.prefix = os.path.join(*sys.prefix.split(os.sep)[:-2])
old_prefix = sys.prefix
sys.path = [p for p in sys.path if sys.prefix not in p]

# mayybe this is necessary
Expand All @@ -79,6 +92,12 @@ def _activate_virtualenv(uranium_dir):
# we modify the executable directly, because pip invokes this to install packages.
sys.executable = os.path.join(uranium_dir, 'bin', 'python')

for name, req in pkg_resources.working_set.by_key.items():
if old_prefix in req.location:
del pkg_resources.working_set.by_key[name]

pkg_resources.working_set.entries = sys.path


def _create_stdout_logger():
""" create a logger to stdout """
Expand Down

0 comments on commit 94c8ebf

Please sign in to comment.