Exemplo n.º 1
0
    def __init__(self, env=None, workspace=None, name='.env', python=None):
        Workspace.__init__(self, workspace)
        self.virtualenv = self.workspace / name
        if sys.platform == 'win32':
            # In virtualenv on windows "Scripts" folder is used instead of "bin".
            self.python = self.virtualenv / 'Scripts' / 'python.exe'
            self.easy_install = self.virtualenv / 'Scripts' / 'easy_install.exe'
            self.coverage = self.virtualenv / 'Scripts' / 'coverage.exe'
        else:
            self.python = self.virtualenv / 'bin' / 'python'
            self.easy_install = self.virtualenv / "bin" / "easy_install"
            self.coverage = self.virtualenv / 'bin' / 'coverage'

        if env is None:
            self.env = dict(os.environ)
        else:
            self.env = dict(env)  # ensure we take a copy just in case there's some modification

        self.env['VIRTUAL_ENV'] = str(self.virtualenv)

        self.env['PATH'] = str(self.python.dirname()) + ((os.path.pathsep + self.env["PATH"])
                                                         if "PATH" in self.env else "")
        if 'PYTHONPATH' in self.env:
            del(self.env['PYTHONPATH'])

        self.virtualenv_cmd = CONFIG.virtualenv_executable
        self.run([self.virtualenv_cmd,
                 '-p', python or cmdline.get_real_python_executable(),
                 str(self.virtualenv)])
Exemplo n.º 2
0
    def __init__(self, env=None, workspace=None, name='.env', python=None, args=None):
        Workspace.__init__(self, workspace)
        self.virtualenv = self.workspace / name
        self.args = args or []
        if sys.platform == 'win32':
            # In virtualenv on windows "Scripts" folder is used instead of "bin".
            self.python = self.virtualenv / 'Scripts' / 'python.exe'
            self.easy_install = self.virtualenv / 'Scripts' / 'easy_install.exe'
            self.coverage = self.virtualenv / 'Scripts' / 'coverage.exe'
        else:
            self.python = self.virtualenv / 'bin' / 'python'
            self.easy_install = self.virtualenv / "bin" / "easy_install"
            self.coverage = self.virtualenv / 'bin' / 'coverage'

        if env is None:
            self.env = dict(os.environ)
        else:
            self.env = dict(env)  # ensure we take a copy just in case there's some modification

        self.env['VIRTUAL_ENV'] = str(self.virtualenv)

        self.env['PATH'] = str(self.python.dirname()) + ((os.path.pathsep + self.env["PATH"])
                                                         if "PATH" in self.env else "")
        if 'PYTHONPATH' in self.env:
            del(self.env['PYTHONPATH'])

        self.virtualenv_cmd = CONFIG.virtualenv_executable
        if isinstance(self.virtualenv_cmd, str):
            cmd = [self.virtualenv_cmd]
        else:
            cmd = list(self.virtualenv_cmd)
        cmd.extend(['-p', python or cmdline.get_real_python_executable()])
        cmd.extend(self.args)
        cmd.append(str(self.virtualenv))
        self.run(cmd)
Exemplo n.º 3
0
    def __init__(self, env=None, workspace=None, name='.env', python=None):
        Workspace.__init__(self, workspace)
        self.virtualenv = self.workspace / name
        self.python = self.virtualenv / 'bin' / 'python'
        self.easy_install = self.virtualenv / "bin" / "easy_install"

        if env is None:
            self.env = dict(os.environ)
        else:
            self.env = dict(env)  # ensure we take a copy just in case there's some modification

        self.env['VIRTUAL_ENV'] = self.virtualenv
        self.env['PATH'] = os.path.dirname(self.python) + ((os.path.pathsep + self.env["PATH"])
                                                           if "PATH" in self.env else "")
        if 'PYTHONPATH' in self.env:
            del(self.env['PYTHONPATH'])

        self.virtualenv_cmd = CONFIG.virtualenv_executable
        self.run('%s -p %s %s --distribute' % (self.virtualenv_cmd,
                                               python or cmdline.get_real_python_executable(),
                                               self.virtualenv))
    def __init__(self, env=None, workspace=None, name='.env', python=None):
        Workspace.__init__(self, workspace)
        self.virtualenv = self.workspace / name
        self.python = self.virtualenv / 'bin' / 'python'
        self.easy_install = self.virtualenv / "bin" / "easy_install"

        if env is None:
            self.env = dict(os.environ)
        else:
            self.env = dict(
                env
            )  # ensure we take a copy just in case there's some modification

        self.env['VIRTUAL_ENV'] = self.virtualenv
        self.env['PATH'] = os.path.dirname(self.python) + (
            (os.path.pathsep + self.env["PATH"]) if "PATH" in self.env else "")
        if 'PYTHONPATH' in self.env:
            del (self.env['PYTHONPATH'])

        self.virtualenv_cmd = CONFIG.virtualenv_executable
        self.run('%s -p %s %s --distribute' %
                 (self.virtualenv_cmd, python
                  or cmdline.get_real_python_executable(), self.virtualenv))