-
Couldn't load subscription status.
- Fork 1.1k
pyinstaller support added to PipEnv #19030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
57efa02
ee7e38a
ce2fe4e
4f03d6e
79b2235
354b647
42ff5cb
42aa371
5425e09
aa63728
4a1d10e
8df2e5c
67fadfb
31f3c53
5c8438e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| import venv | ||
| import platform | ||
| import os | ||
| import shutil | ||
| import sys | ||
|
|
||
| from conan.tools.build import cmd_args_to_string | ||
| from conan.tools.env.environment import Environment | ||
| from conan.errors import ConanException | ||
|
|
||
|
|
||
| class PipEnv: | ||
|
|
@@ -23,6 +25,18 @@ def generate(self): | |
| env.prepend_path("PATH", self.bin_dir) | ||
| env.vars(self._conanfile).save_script(self.env_name) | ||
|
|
||
| def _create_venv(self): | ||
| python_interpreter = self._conanfile.conf.get( | ||
| "tools.system.pipenv:python_interpreter", | ||
| default=shutil.which('python') if platform.system() == "Windows" else shutil.which('python3')) | ||
|
||
| if not python_interpreter: | ||
| raise ConanException("PipEnv could not find a Python executable path.") | ||
czoido marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| try: | ||
| self._conanfile.run(cmd_args_to_string([python_interpreter, '-m', 'venv', self._env_dir])) | ||
| except ConanException: | ||
| raise ConanException("PipEnv could not create a Python virtual environment.") | ||
czoido marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| def install(self, packages, pip_args=None): | ||
| """ | ||
| Will try to install the list of pip packages passed as a parameter. | ||
|
|
@@ -34,7 +48,7 @@ def install(self, packages, pip_args=None): | |
| :return: the return code of the executed pip command. | ||
| """ | ||
|
|
||
| venv.EnvBuilder(clear=True, with_pip=True).create(self._env_dir) | ||
| self._create_venv() | ||
czoido marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| args = [self._python_exe, "-m", "pip", "install", "--disable-pip-version-check"] | ||
| if pip_args: | ||
| args += list(pip_args) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.