def make_exe(): # Obtain the default PythonDistribution for our build target. We link # this distribution into our produced executable and extract the Python # standard library from it. dist = default_python_distribution() dependencies = ["-r", "requirements.txt"] policy = dist.make_python_packaging_policy() policy.resources_location_fallback = "filesystem-relative:lib" python_config = dist.make_python_interpreter_config() python_config.config_profile = "python" # Evaluate a string as Python code when the interpreter starts. python_config.run_command = "from flameshow.main import main; main()" # Produce a PythonExecutable from a Python distribution, embedded # resources, and other options. The returned object represents the # standalone executable that will be built. exe = dist.to_python_executable( name="querent", # If no argument passed, the default `PythonPackagingPolicy` for the # distribution is used. packaging_policy=policy, # If no argument passed, the default `PythonInterpreterConfig` is used. config=python_config, ) for resource in exe.pip_install(dependencies): resource.add_location = "filesystem-relative:lib" exe.add_python_resource(resource) return exe def make_embedded_resources(exe): return exe.to_embedded_resources() def make_install(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) return files # Tell PyOxidizer about the build targets defined above. register_target("exe", make_exe) register_target("resources", make_embedded_resources, depends=["exe"], default_build_script=True) register_target("install", make_install, depends=["exe"], default=True) # Resolve whatever targets the invoker of this configuration file is requesting # be resolved. resolve_targets()