mirror of
https://github.com/ankitects/anki.git
synced 2025-12-14 07:10:59 -05:00
use PYTHON_SYS_EXECUTABLE for setting path to Python
This commit is contained in:
parent
5dd0eaf0a2
commit
355e4cd519
3 changed files with 11 additions and 7 deletions
3
.bazelrc
3
.bazelrc
|
|
@ -1,8 +1,9 @@
|
||||||
common --enable_platform_specific_config
|
common --enable_platform_specific_config
|
||||||
common --experimental_repository_cache_hardlinks
|
common --experimental_repository_cache_hardlinks
|
||||||
|
|
||||||
# specify python path on Windows for pyo3 compile
|
# specify python path for pyo3 compile
|
||||||
build:windows --action_env="PYTHON_SYS_EXECUTABLE=c:\\python\\python.exe"
|
build:windows --action_env="PYTHON_SYS_EXECUTABLE=c:\\python\\python.exe"
|
||||||
|
#build:linux --action_env="PYTHON_SYS_EXECUTABLE=/usr/local/bin/python3.8"
|
||||||
|
|
||||||
# runfiles are off by default on Windows, and we need them
|
# runfiles are off by default on Windows, and we need them
|
||||||
build --enable_runfiles
|
build --enable_runfiles
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ other than /usr/bin, you'll need to put the following into a file called user.ba
|
||||||
at the top of this repo before proceeding:
|
at the top of this repo before proceeding:
|
||||||
|
|
||||||
```
|
```
|
||||||
build --action_env=PYTHON_SYS_EXECUTABLE=/usr/local/bin/python
|
build --action_env=PYTHON_SYS_EXECUTABLE=/usr/local/bin/python3.8
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're building Anki from a docker container or distro that has no `python` command in
|
If you're building Anki from a docker container or distro that has no `python` command in
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,16 @@ def _impl(rctx):
|
||||||
"python.exe",
|
"python.exe",
|
||||||
]
|
]
|
||||||
path = None
|
path = None
|
||||||
|
if rctx.os.environ.get("PYTHON_SYS_EXECUTABLE"):
|
||||||
|
path = rctx.os.environ.get("PYTHON_SYS_EXECUTABLE")
|
||||||
|
else:
|
||||||
for name in names:
|
for name in names:
|
||||||
path = rctx.which(name)
|
path = rctx.which(name)
|
||||||
if path:
|
if path:
|
||||||
break
|
break
|
||||||
|
|
||||||
if not path:
|
if not path:
|
||||||
fail("python3 or python.exe not found on path")
|
fail("python3 or python.exe not found on path, and PYTHON_SYS_EXECUTABLE not set")
|
||||||
|
|
||||||
rctx.symlink(path, "python")
|
rctx.symlink(path, "python")
|
||||||
rctx.file("BUILD.bazel", """
|
rctx.file("BUILD.bazel", """
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue