Commits

Stan Seibert committed 3151a7b

Follow better practice for running commands inside a shell

Comments (0)

Files changed (3)

         # Monkey-patch the virtualenv activate script
         activate = os.path.join(VIRTUAL_ENV, 'bin', 'activate')
         shrinkwrap_fragment = '''#begin shrinkwrap (DO NOT EDIT THIS SECTION)
-`shrinkwrap activate`
+eval $(shrinkwrap activate)
 #end shrinkwrap'''
         with open(activate, 'r') as f:
             activate_contents = f.read()

shrinkwrap/command.py

     VIRTUAL_ENV = os.environ['VIRTUAL_ENV']
     env_pattern = os.path.join(VIRTUAL_ENV, 'env.d', '*.sh')
     if len(glob.glob(env_pattern)) > 0:
-        print 'source', ' '.join([os.path.realpath(filename) for filename in glob.glob(env_pattern)])
+        print '; '.join(['source ' + os.path.realpath(filename) for filename in glob.glob(env_pattern)])
 
 
 def createpkg(argv):

shrinkwrap/install.py

         '''Runs ``cmd`` in a shell.  Raises shrinkwrap.CommandError if the
         return code from ``cmd`` is not equal to ``success_return_code``.'''
         log.warn('Executing: ' + cmd)
-        ret = subprocess.call('`shrinkwrap activate` && ' + cmd, shell=True, executable='/bin/bash')
+        ret = subprocess.call('eval $(shrinkwrap activate) && ' + cmd, shell=True, executable='/bin/bash')
         if ret != success_return_code:
             raise CommandError(cmd, ret)