How to use the virtualenv.subprocess.Popen function in virtualenv

To help you get started, we’ve selected a few virtualenv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github csrocha / odooenv / odooenv / environment.py View on Github external
return self.addonsourcepath

        if self.server_config and self.server_config.has_option('options',
                                                                'addons_path'):
            paths = self.server_config.get('options', 'addons_path')
            for p in paths.split(','):
                p = os.path.abspath(p)
                if exists(p) and os.access(p, os.W_OK):
                    addons_path = p
                else:
                    return False
        else:

            python_exe = join(self.root, 'bin', 'python')

            p = subprocess.Popen([python_exe],
                                 stdout=subprocess.PIPE,
                                 stdin=subprocess.PIPE,
                                 stderr=DEVNULL)
            out, err = p.communicate(
                "import pkg_resources, os.path\n"
                "out = pkg_resources.resource_filename('openerp', 'addons')\n"
                "print(out)\n"
                "exit()\n"
            )
            addons_path = out.strip() or False

        self.addonsourcepath = addons_path
        return addons_path
github csrocha / odooenv / odooenv / environment.py View on Github external
def execute(self, command, args, no_wait=False,
                check_for_termination=False):
        """
        Execute a command in the python environment defined in
        set_python_environment()
        """
        if no_wait:
            P = subprocess.Popen([join(self.root, 'bin', command)] + args)
            if check_for_termination:
                time.sleep(5)
                if not P.poll() is None:
                    return None
            return P.pid
        else:
            P = subprocess.Popen([join(self.root, 'bin', command)] + args)
            P.wait()
            return None
github csrocha / odooenv / odooenv / environment.py View on Github external
def execute(self, command, args, no_wait=False,
                check_for_termination=False):
        """
        Execute a command in the python environment defined in
        set_python_environment()
        """
        if no_wait:
            P = subprocess.Popen([join(self.root, 'bin', command)] + args)
            if check_for_termination:
                time.sleep(5)
                if not P.poll() is None:
                    return None
            return P.pid
        else:
            P = subprocess.Popen([join(self.root, 'bin', command)] + args)
            P.wait()
            return None