| # This file defines how PyOxidizer application building and packaging is |
| # performed. See the pyoxidizer crate's documentation for extensive |
| # documentation on this file format. |
| |
| # Obtain the default PythonDistribution for our build target. We link |
| # this distribution into our produced executable and extract the Python |
| # standard library from it. |
| def make_dist(): |
| return default_python_distribution() |
| |
| # Configuration files consist of functions which define build "targets." |
| # This function creates a Python executable and installs it in a destination |
| # directory. |
| def make_exe(dist): |
| # This variable defines the configuration of the |
| # embedded Python interpreter. |
| python_config = PythonInterpreterConfig( |
| sys_paths=["$ORIGIN/.blacklib"], |
| run_module="black", |
| ) |
| |
| # Produce a PythonExecutable from a Python distribution, embedded |
| # resources, and other options. The returned object represents the |
| # standalone executable that will be built. |
| return dist.to_python_executable( |
| name="black", |
| config=python_config, |
| # Embed all extension modules, making this a fully-featured Python. |
| extension_module_filter="all", |
| include_sources=False, |
| include_resources=False, |
| include_test=False, |
| ) |
| |
| def make_embedded_resources(exe): |
| return exe.to_embedded_resources() |
| |
| def make_install(dist, exe): |
| # Create an object that represents our installed application file layout. |
| files = FileManifest() |
| |
| # Add the generated executable to our install layout in the root directory. |
| files.add_python_resource(".", exe) |
| |
| files.add_python_resources(".blacklib", dist.pip_install(["black==19.10b0"])) |
| |
| return files |
| |
| # Tell PyOxidizer about the build targets defined above. |
| register_target("dist", make_dist) |
| register_target("exe", make_exe, depends=["dist"], default=True) |
| register_target("resources", make_embedded_resources, depends=["exe"], default_build_script=True) |
| register_target("install", make_install, depends=["dist", "exe"]) |
| |
| # Resolve whatever targets the invoker of this configuration file is requesting |
| # be resolved. |
| resolve_targets() |
| |
| # Everything below this is typically managed by PyOxidizer and doesn't need |
| # to be updated by people. |
| |
| PYOXIDIZER_VERSION = "0.7.0" |
| PYOXIDIZER_COMMIT = "UNKNOWN" |