xref: /aosp_15_r20/external/pigweed/pw_env_setup/py/pyoxidizer.bzl.tmpl (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2020 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15def make_dist():
16    return default_python_distribution()
17
18def make_exe(dist):
19    python_config = PythonInterpreterConfig(
20         run_module='pw_env_setup.env_setup',
21    )
22
23    exe = dist.to_python_executable(
24        name="pw_env_setup",
25        config=python_config,
26        extension_module_filter='all',
27        include_sources=True,
28        include_resources=True,
29        include_test=False,
30    )
31    exe.add_python_resources(dist.pip_install(["${PW_ROOT}/pw_env_setup/py"]))
32
33    return exe
34
35def make_embedded_data(exe):
36    return exe.to_embedded_data()
37
38def make_install(exe):
39    files = FileManifest()
40    files.add_python_resource(".", exe)
41    return files
42
43register_target("dist", make_dist)
44register_target("exe", make_exe, depends=["dist"], default=True)
45register_target("embedded", make_embedded_data, depends=["exe"],
46                default_build_script=True)
47register_target("install", make_install, depends=["exe"])
48
49resolve_targets()
50
51# END OF COMMON USER-ADJUSTED SETTINGS.
52#
53# Everything below this is typically managed by PyOxidizer and doesn't need
54# to be updated by people.
55
56PYOXIDIZER_VERSION = "0.6.0"
57PYOXIDIZER_COMMIT = "UNKNOWN"
58