indygreg / indygreg/PyOxidizer

pyoxidizer ignores the specified target python distribution

Open
#326 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

**description:**
trying to build an executable targetting mac os.

**command:**
```
RUST_BACKTRACE=full MACOSX_DEPLOYMENT_TARGET=10.9 pyoxidizer build
```

**config file:**
```
def make_dist():
return PythonDistribution(local_path="/home/sarpedon/pyoxidizer/starter-zero/cpython-3.8.6-x86_64-apple-darwin-pgo-20201020T0626.tar.zst",sha256="e06807ed4d68928634b2690a86ea7a13d339c0fff3808816e98c646bbdc1f79a")
def make_exe(dist):
policy = dist.make_python_packaging_policy()
python_config = dist.make_python_interpreter_config()
python_config.run_module = "payload3"
exe = dist.to_python_executable(
name="starter-zero",
packaging_policy=policy,
config=python_config,
)
exe.add_python_resources(exe.read_package_root(
path=CWD,
packages=["payload3"],
))
return exe

def make_embedded_resources(exe):
return exe.to_embedded_resources()

def make_install(exe):
files = FileManifest()
files.add_python_resource(".", exe)
return files
register_target("dist", make_dist)
register_target("exe", make_exe, depends=["dist"])
register_target("resources", make_embedded_resources, depends=["exe"], default_build_script=True)
register_target("install", make_install, depends=["exe"], default=True)
resolve_targets()

PYOXIDIZER_VERSION = "0.10.1"
PYOXIDIZER_COMMIT = "cbab9171248d12a9668331fbdc52465e66bc6aee"
```

**expected result:**
pyoxidizer will use the specified distribution as it's build target.

**actual result:**
pyoxidizer first read the custom distribution as specified but then tries to download and build the default distribution which it fails to do so.

**output:**
```
resolving Python distribution Local { local_path: "/home/sarpedon/pyoxidizer/starter-zero/cpython-3.8.6-x86_64-apple-darwin-pgo-20201020T0626.tar.zst", sha256: "e06807ed4d68928634b2690a86ea7a13d339c0fff3808816e98c646bbdc1f79a" }
copying /home/sarpedon/pyoxidizer/starter-zero/cpython-3.8.6-x86_64-apple-darwin-pgo-20201020T0626.tar.zst
Python distribution available at /home/sarpedon/pyoxidizer/starter-zero/./build/python_distributions/cpython-3.8.6-x86_64-apple-darwin-pgo-20201020T0626.tar.zst
reading data from Python distribution..

resolving Python distribution Url { url: "https://github.com/indygreg/python-build-standalone/releases/download/20201020/cpython-3.8.6-x86_64-unknown-linux-gnu-pgo-20201020T0627.tar.zst", sha256: "789f58ece3ab4ee599e9fd7f6bd9665157ba1a57dca210739df0687ce3757b55" }
downloading https://github.com/indygreg/python-build-standalone/releases/download/20201020/cpython-3.8.6-x86_64-unknown-linux-gnu-pgo-20201020T0627.tar.zst
Python distribution available at /home/sarpedon/pyoxidizer/starter-zero/./build/python_distributions/cpython-3.8.6-x86_64-unknown-linux-gnu-pgo-20201020T0627.tar.zst

error[PYOXIDIZER_BUILD]: command ["cargo", "build", "--target", "x86_64-unknown-linux-gnu", "--target-dir", "/tmp/pyoxidizer.bLb59GulOc4n/build/target", "--bin", "starter-zero", "--no-default-features", "--features", "build-mode-prebuilt-artifacts cpython-link-unresolved-static jemalloc"] exited with code 101
--> ./pyoxidizer.bzl:23:5
|
23 | files.add_python_resource(".", exe)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add_python_resource
```

the complete output with full backtrace is posted in [#325 ](https://github.com/indygreg/PyOxidizer/issues/325#issue-741951660)

OS: UBUNTU 18.04.3
Architecture: x86_64
PyOxidizer: 0.10.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with pyoxidizer.bzl at line 23 and the make_dist target using the local PythonDistribution. Reproduce the command and compare the logged local distribution resolution with the later default URL distribution resolution. Done means the specified distribution is used throughout the build without resolving the default distribution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.