Skip to content

Commit 01cd220

Browse files
ssbrindygreg
authored andcommitted
pyoxidizer: fix bad examples in docs
They still don't work, but at least they don't work in a more subtle way. Before: without `resolve_targets()`: ``` $ pyoxidizer build error: target exe is not resolved ``` with `resolve_targets()`, but without removing the `dist` arg: ``` $ pyoxidizer build resolving 1 targets resolving target exe error[CF00]: Missing parameter dist for call to <function make_exe from pyoxidizer>(dist) --> ./pyoxidizer.bzl:10:1 | 10 | resolve_targets() | ^^^^^^^^^^^^^^^^^ Not enough parameters in function call error: Missing parameter dist for call to <function make_exe from pyoxidizer>(dist) ``` Now: ``` <lots of build output> writing executable to /..././build/x86_64-unknown-linux-gnu/debug/exe/myapp error: error calling build(): Runtime(RuntimeError { code: "PYOXIDIZER_PYTHON_EXECUTABLE", message: "creating /..././build/x86_64-unknown-linux-gnu/debug/exe/myapp\n\nCaused by:\n No such file or directory (os error 2)", label: "PythonExecutable.build()" }) ``` So that's an improvement. No idea where to go from here but hey. (Tried with both `pipx run` on python 3.9, and `pip install pyoxidizer --user` with 3.7. Broken on both.)
1 parent d4b1974 commit 01cd220

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pyoxidizer/docs/pyoxidizer_packaging_config_file.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ In this example, we create an executable embedding Python:
3232

3333
.. code-block:: python
3434
35-
def make_exe(dist):
35+
def make_exe():
3636
dist = default_python_distribution()
3737
3838
return dist.to_python_executable("myapp")
3939
4040
register_target("exe", make_exe)
41+
resolve_targets()
4142
4243
:py:meth:`PythonDistribution.to_python_executable` accepts an optional
4344
:py:class:`PythonPackagingPolicy` instance that influences how the executable
@@ -67,7 +68,7 @@ this instance into the constructed :py:class:`PythonExecutable`:
6768

6869
.. code-block:: python
6970
70-
def make_exe(dist):
71+
def make_exe():
7172
dist = default_python_distribution()
7273
7374
config = dist.make_python_interpreter_config()
@@ -76,6 +77,7 @@ this instance into the constructed :py:class:`PythonExecutable`:
7677
return dist.to_python_executable("myapp", config=config)
7778
7879
register_target("exe", make_exe)
80+
resolve_targets()
7981
8082
The :py:class:`PythonInterpreterConfig` type exposes a lot of modifiable settings.
8183
See the :py:class:`API documentation <PythonInterpreterConfig>` for
@@ -147,7 +149,7 @@ instance using
147149

148150
.. code-block:: python
149151
150-
def make_exe(dist):
152+
def make_exe():
151153
dist = default_python_distribution()
152154
153155
return dist.to_python_executable("myapp")
@@ -164,6 +166,7 @@ instance using
164166
165167
register_target("exe", make_exe)
166168
register_target("install", make_install, depends=["exe"], default=True)
169+
resolve_targets()
167170
168171
We introduce a new ``install`` target and ``make_install()`` function which
169172
returns a :py:class:`starlark_tugger.FileManifest`. It adds the

0 commit comments

Comments
 (0)