Commits

Ronny Pfannschmidt committed b83fb8b

refactor make_gateway to base classes, add spec property to venvs

  • Participants
  • Parent commits 0320efe

Comments (0)

Files changed (1)

File virtualenvmanager.py

         args.extend(packages)
         return self.pcall('easy_install', *args)
 
-    def _venv_fixed_gateway(self, spec):
+    def makegateway(self):
         '''
         pseudo-fix sys.path in the venv
         '''
         import execnet
-        gw = execnet.makegateway(spec)
+        gw = execnet.makegateway(self.spec)
         channel = gw.remote_exec("""
             import sys
             sys.path.insert(0, sys.path[-1])
         cmd = '%s -u -c "import sys;print(sys.version)"'
         return commands.getoutput(cmd%self._cmd('python')).strip()
 
-    def makegateway(self):
-        import execnet
-        spec = 'popen//python=%s//chdir=%s'%(
+    @property
+    def spec(self):
+        return 'popen//python=%s//chdir=%s'%(
                     self._cmd('python'),
                     self.path,
                 )
-        return self._venv_fixed_gateway(spec)
 
 
 class RemoteVirtualenv(VirtualEnvBase):
             ''')
         channel.send(cmd)
         return channel.receive()
-
-    def makegateway(self):
+    
+    @property
+    def spec(self):
         from execnet.xspec import XSpec
         meta = XSpec(str(self.gw.spec))
         meta.chdir=self.path
         elif meta.popen:
             base = 'popen//python=%(python)s//chdir=%(chdir)s'
         else:
-            raise RuntimeError('wrong xspec')
-        spec = base % vars(meta)
-        return self._venv_fixed_gateway(spec)
+            raise RuntimeError('wrong xspec', str(meta))
+        return base % vars(meta)