aboutsummaryrefslogtreecommitdiff
path: root/python
Commit message (Collapse)AuthorAgeFilesLines
* Allow adding extra tradefed options in the Android.bp fileCole Faust2023-01-031-3/+8
| | | | | | | | | | | | Some tests need to add custom tradefed options, but still want to keep most of the soong autogenerated tradefed xml file. Expose a test_options: { tradefed_options: [...] } property that will allow tests to add more options to the autogenerated xml file. Fixes: 184895128 Test: go test, and verified that the ninja files did not change for aosp_arm64 Change-Id: I50d4ad139322e9e207202f1e1a50f5bbb424aa6f
* Revert "Allow adding extra tradefed options in the Android.bp file"Tahsin Loqman2022-12-191-8/+3
| | | | | | | | This reverts commit 8ec823cba166a41eb0e9e5ff8fe679e691fec678. Reason for revert: DroidMonitor: Potential culprit for Bug b/262965953 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Change-Id: I236cc36981d8b30527ca286632727f8ca267e969
* Allow adding extra tradefed options in the Android.bp fileCole Faust2022-12-091-3/+8
| | | | | | | | | | | | Some tests need to add custom tradefed options, but still want to keep most of the soong autogenerated tradefed xml file. Expose a test_options: { tradefed_options: [...] } property that will allow tests to add more options to the autogenerated xml file. Fixes: 184895128 Test: go test, and verified that the ninja files did not change for aosp_arm64 Change-Id: I75f7eb002c8325ce7cdc76e12e76e16195320620
* Remove flags that enable the new python path behaviorCole Faust2022-10-219-109/+19
| | | | | | | | | The new behavior has been enabled by default, and these flags aren't necessary anymore. Fixes: 245583294 Test: m py_dont_import_folder_of_entrypoint_test && /ssd/aosp-master/out/host/linux-x86/testcases/py_dont_import_folder_of_entrypoint_test/x86_64/py_dont_import_folder_of_entrypoint_test Change-Id: I5b6f98da51791bc5d28662ef799a10c1bb6a35a0
* Merge "Fix some issues in bp2build converter for python_binary_host."Wei Li2022-10-132-15/+15
|\
| * Fix some issues in bp2build converter for python_binary_host.Wei Li2022-10-122-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | 1) Bp2build convert python_binary_host main attribute as LabelAttribute. Currently "main" attribute in python_binary_host is handled as string but for some modules (e.g certify_bootimg) the "main" attribute points to a file in its subpackage like "subpackage/file.py" and should be converted to "//.../subpackage:file.py". 2) Filter out duplicated labels in the merged list of "required" attributes of python_binary_host and its defaults. Test: b build //system/tools/mkbootimg:certify_bootimg Test: b build //build/make/tools/releasetools:check_target_files_signatures Bug: 253081249 Bug: 253101186 Change-Id: Ic2cb4cadec2c1348da70af9f0730da9914d3a8ca
* | Merge "Revert^2 "Enable new python path behavior by default""Cole Faust2022-10-112-4/+3
|\ \ | |/ |/|
| * Revert^2 "Enable new python path behavior by default"Cole Faust2022-10-112-4/+3
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 4d5cc709fa16f5dc78f690369e946fcf66156312. Reason for revert: Acloud issue was fixed in aosp/2243150, make sure the host unit tests are run on this cl via go/abtd before submitting Change-Id: Ie148430d331a01a9877adaf3cb88f1c57af136a0 Bug: 245583294 Bug: 247578564 Bug: 251688241
* | Merge "Revert "Enable new python path behavior by default""Lais Andrade2022-10-072-3/+4
|\|
| * Revert "Enable new python path behavior by default"Lais Andrade2022-10-072-3/+4
| | | | | | | | | | | | | | | | This reverts commit 5fe655d1c71ee079dd46e93c96b54aae39a10d16. Reason for revert: DroidMonitor: Potential culprit for Bug b/251688241 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Change-Id: I1ea4df27557fc891d8f0156ec5681f9b0c601c98
* | Merge "Enable new python path behavior by default"Treehugger Robot2022-10-072-4/+3
|\|
| * Enable new python path behavior by defaultCole Faust2022-10-052-4/+3
| | | | | | | | | | | | | | | | | | | | | | Now that usages have been updated, enable the new behavior by default. If everything goes well with this, we can then remove the flags. Bug: 245583294 Bug: 247578564 Test: Presubmits Change-Id: Idac8d2dc0f96ae750dba4a99b32525676d0d6f25
* | [LSC] Add LOCAL_LICENSE_KINDS to build/soongBob Badour2022-09-292-0/+8
|/ | | | | | | | | | | | | Added SPDX-license-identifier-Apache-2.0 to: python/tests/dont_import_folder_of_entrypoint/Android.bp python/tests/top_level_dirs/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Change-Id: I7a1ea160c685361318f9a8543e10b83eeb9dcb7f
* Add binary properties to python_defaults and add modern_python_path_defaultsCole Faust2022-09-263-7/+15
| | | | | | | | | | | | | So that we can more easily enable these new flags on several modules. It seems you can still apply a python_defaults to a python_library even with this change, so I didn't break it out into a separate python_binary_defaults. Bug: 245583294 Test: m py_dont_import_folder_of_entrypoint_test && out/host/linux-x86/testcases/py_dont_import_folder_of_entrypoint_test/x86_64/py_dont_import_folder_of_entrypoint_test Change-Id: Iecf9c1845df4630bafdea9957eb2450c15f8596b
* Add flag to not add directory of entrypoint to sys.pathCole Faust2022-09-266-16/+96
| | | | | | | | | | | | | | | | | | | | The python interpreter will by default add the directory of the entrypoint script to the beginning of sys.path. This can be disabled in python 3.11+ (which is not released yet) using the PYTHON_SAFE_PATH environment variable or the -P flag. As a workaround to have this behavior in older python versions, we can make an __soong_entrypoint_redirector__.py file at the root of the zip file that is the entrypoint, and then that file will redirect to the real entrypoint. This brings non-embedded-launcher python modules closer to the embedded launcher version. The embedded launcher binaries already act like this because they start at an __main__.py file at the root of the zip file. Bug: 245583294 Test: m py_dont_import_folder_of_entrypoint_test && out/host/linux-x86/nativetest64/py_dont_import_folder_of_entrypoint_test/py_dont_import_folder_of_entrypoint_test Change-Id: I39aaf04fb19c3ba7f5c9d98220872d6d08abf736
* Merge "Add flag to not add top-level modules to PYTHONPATH"Cole Faust2022-09-268-80/+68
|\
| * Add flag to not add top-level modules to PYTHONPATHCole Faust2022-09-238-80/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | stub_template_host.txt added all the top-level modules to the PYTHONPATH, which isn't correct, and caused absl.logging to override the built-in logging module. Removing this also makes it more consistent with python binaries built with embedded_launcher: true. embedded_launcher: true binaries don't add the top-level modules. Fixes: 245583294 Test: m py_dont_add_top_level_dirs_test && out/host/linux-x86/testcases/py_dont_add_top_level_dirs_test/x86_64/py_dont_add_top_level_dirs_test Change-Id: Id3069565d2b2c4b2bda0ff5301e757a7b4201751
* | [LSC] Add LOCAL_LICENSE_KINDS to build/soongBob Badour2022-09-221-0/+4
|/ | | | | | | | | | | | Added SPDX-license-identifier-Apache-2.0 to: python/tests/proto_pkg_path/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Change-Id: I17e9945a265d0ede3e291ed6f5d410dde035fbe5
* Make protobufs respect pkg_path properlyCole Faust2022-09-205-1/+72
| | | | | | | | | | | | | | | | | | | | | | | Currently, python protobuf sources are generated as if pkg_path didn't exist, but then are moved into the pkg_path directory after being generated. This means they're generated with import statements in them that don't include the pkg_path. These import statements won't work at all when pkg_path is at least 2 levels deep, but currently erroneously work with a 1 level deep pkg_path because we mistakenly add the top-level modules in a soong-built python zip to the PYTHONPATH. We want to remove those modules from the PYTHONPATH, so the generated protobuf source files have to use the correct imports. Since there are existing cases of code that needs to be updated, guard this new behavior behind a flag, protos_respect_pkg_path. We will set this to true on modules individually as we update them, and then eventually change the default to true and remove this flag. Bug: 247578564 Test: m py_proto_pkg_path_test && out/host/linux-x86/nativetest64/py_proto_pkg_path_test/py_proto_pkg_path_test Change-Id: I3695cf5521837da087592f2ad5350201035b7b0e
* Don't close file descriptors when starting python programCole Faust2022-09-091-1/+3
| | | | | | | | | | | Python programs run via a wrapper script. That wrapper script can be started with open file descriptors, for example by using the <(echo foo) syntax in bash. The shouldn't be closed when starting the real script. Bug: 203436762 Test: Presubmits Change-Id: Ib20450f713b15c8a5527d1e433bfd9635cead85f
* Reformat build/soong for go 1.19Colin Cross2022-08-171-3/+3
| | | | | Test: none Change-Id: I132368f0fcbdb5ea088b5b84dbe4ccfdd9e94cad
* Move common test_options properties into the android packageZhenhuang Wang2022-08-172-8/+2
| | | | | | | | | | Multiple modules (e.g. java, cc, python, rust) define the `test_options` field. Extract the common properties in test_options to share across different test rules. Bug: 240928948 Test: `refreshmod` and diff with original module-info.json Change-Id: I404a7a157b4ccaa53d800ee2217559ff695bd825
* Allowlist apexer for bp2buildCole Faust2022-06-093-33/+34
| | | | | | | | | | | This also introduces a workaround for the fact that apexer depends on aapt2, but aapt2 doesn't build with bp2build yet. Aapt2 is removed from apexer's requirements during bp2build. Bug: 204244290 Test: ./build/bazel/ci/bp2build.sh Change-Id: I837597ce035c7d5c06e1a3957166583a7a94b5c7
* Add bp2build converter for python protobuf filesCole Faust2022-05-262-0/+28
| | | | | | Bug: 196084681 Test: b run //build/bazel/examples/python/protobuf:build_bazel_examples_python_protobuf_main --config=linux_x86_64 Change-Id: I4d806902d262351231f64686a5d24513a25d9749
* Add imports property to py_library rulesCole Faust2022-05-191-2/+34
| | | | | | | | | | | | | | | | | This is to avoid having it hardcoded in a fork of the py_library rule. Most import attributes should just be set to ".", but our previous solution always hardcoded it to ".." instead, for ndkstubgen. ndkstubgen uses pkg_path: "ndkstubgen", i.e., it set pkg_path to the name of the folder that contained the Android.bp file. In this specific scenario, imports = ".." works. Recreate that behavior here as well, because we don't handle pkg_path properly yet. Fixes: 233081071 Test: build/bazel/ci/bp2build.sh Change-Id: Ib5e6a8edf428c74d4b5947f0ec53a2151001367a
* Support building python pars against static or shared musl libcColin Cross2022-03-081-0/+7
| | | | | | | | | | | Support building python pars against musl libc by either adding libc_musl as an install dependency or using the static version of the python launchers. Bug: 179809553 Test: m USE_HOST_MUSL=true apexer deapexer Test: m USE_HOST_MUSL=true BUILD_HOST_static=true apexer deapexer Change-Id: I4a56efb227bea746836eb785d929eb4b5d8e15f1
* Remove InstallBypassMake and ToMakePathColin Cross2021-12-151-1/+1
| | | | | | | | InstallBypassMake and ToMakePath are obsolete, remove them. Bug: 204136549 Test: m checkbuild Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
* Use one mutator for all bp2build conversion.Liz Kammer2021-12-143-44/+25
| | | | | | | | | | | | Each conversion required defining a separate mutator, which will each operate on _all_ modules and requires each to repeat checks whether the mutator should operator. Instead, we introduce a single mutator and modules can define a ConvertWithBp2build to implement bp2build conversion for that module. Test: bp2build.sh Bug: 183079158 Change-Id: I99d4b51f441c2903879092c5b56313d606d4338d
* Allowlist //build/soong/cc/{ndkstubgen,symbolfile}.Jingwen Chen2021-12-031-2/+2
| | | | | | | | | | This contains the tool to generate stub libraries. Bug: 208215661 Bug: 207812332 Test: b run //build/soong/cc/ndkstubgen Change-Id: Id48d74381457e0a62aca0ed7f8a9367886863bfd
* Support empty strings in bp2buildLiz Kammer2021-12-012-10/+11
| | | | | | | | | Previously, could not set an empty string as a value of an attribute; however, this is necessary in some cases. To not unnecessarily create an empty string, use string pointers for attributes rather than strings. Test: go test bp2build tests Change-Id: I03b3a3567452d455246d22d81f86c317d06b7c39
* Switch default for InstallBypassMake to trueColin Cross2021-11-221-6/+0
| | | | | | | | | Enable InstallBypassMake for all module types by switching its default to true. Bug: 204136549 Test: m checkbuild Change-Id: Ied082995e74d71dee6aecea99689ac3f63600d3b
* Revert "Fix python_binary_host module in mixed build."Rupert Shuttleworth2021-11-033-15/+6
| | | | | | | | | | | Revert submission 1861755-fix_python_binary_host_in_mixed_build Reason for revert: Broke Bazel CI, please see https://android-build.googleplex.com/builds/submitted/7879108/mixed_droid-clean/latest/view/logs/build_error.log and https://android-build.googleplex.com/builds/submitted/7879108/mixed_droid-incremental/latest/view/logs/build_error.log Reverted Changes: Ica457ee71:Add platform needed by python_binary_host. Ibc8b99a92:Fix python_binary_host module in mixed build. Change-Id: I3d6c4f6edee2d00bdc78efd5cee64f4c915baeaa
* Fix python_binary_host module in mixed build.Wei Li2021-11-023-6/+15
| | | | | | | | | Test: USE_BAZEL_ANALYSIS=1 m genfunctosyscallnrs Test: USE_BAZEL_ANALYSIS=1 m func_to_syscall_nrs Test: USE_BAZEL_ANALYSIS=1 m libseccomp_policy Bug: 201094425, 197135289 Change-Id: Ibc8b99a92149410c8a879b7a4facf6c8961a7b9f
* Bp2Build common properties auto-handlingAlex Márquez Pérez Muñíz Díaz Púras Thaureaux2021-10-042-6/+8
| | | | | | | | | | | | | | | | | Introduce `commonAttributes` & `fillCommonBp2BuildModuleAttrs used in CreateBazelTargetModule Adapt `bp2BuildInfo` to use `commonAttrs` instead of `Name`. And thus also all downstream users of `CreateBazelTargetModule`. As initial user, the Soong `required` property will be translated to Bazel's `data`. Bug: 198146582, 196091467 Test: build_converstion_test.go:TestCommonBp2BuildModuleAttrs Test: go test Test: mixed_{libc,droid}.sh Change-Id: Ib500e40f7e2cb48c459f1ebe3188962fc41ec124
* Have python_*{,_host} handle arch-variantsAlex Márquez Pérez Muñíz Díaz Púras Thaureaux2021-10-013-14/+41
| | | | | | | | Bug: 196081778 Test: TestPython*{,Host}ArchVariance Test: go test Test: mixed_{libc,droid}.sh Change-Id: I89304e58f5bacd61534732bade4ad6bb5f2671c0
* Remove arch-variant from some python propertiesLiz Kammer2021-09-201-4/+4
| | | | | | | Version and package should not vary based on architecture. Test: m nothing Change-Id: Id9cb655d9c25caee3b6068a261b3db36e1654467
* Merge "Add module based host-tools snapshot"Rob Seymour2021-09-141-6/+9
|\
| * Add module based host-tools snapshotRob Seymour2021-09-131-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new module: host_snapshot { name: "host-snapshot" deps: [ (list of host tools) ], ... } Package host tools using android.PackagingBase to capture host tools and transitive packaging data. Add JSON meta data to snapshot that allows snapshot to be installed via development/vendor_snapshot/update.py Add support to generate a fake host snapshot of all host modules that is used to detect required modules via development/vendor_snapshot/update.py. Bug: 192556798 Bug: 194799048 Bug: 192896149 Test: m HOST_FAKE_SNAPSHOT_ENABLE=true host-fake-snapshot dist -- check snapshot exists in dist Change-Id: I849c4db801cd858408f6fe6a3ce69262a23a5be9
* | python_{binary,library}{,_host} handle lib propertyAlex Márquez Pérez Muñíz Díaz Púras Thaureaux2021-08-272-0/+6
| | | | | | | | | | | | | | | | | | | | Have binary and library bp2build convert `libs` to `deps` for bazel Bug: 196083751 Test: python_{binary,library}_conversion_test.go Test: build/bazel/ci/mixed_{libc,droid}.sh Change-Id: I2d5f6ef2e83dd608910edb7adb2eb9a56d25293c
* | Add python_library_host -> py_library bp2build supportAlex Márquez Pérez Muñíz Díaz Púras Thaureaux2021-08-261-4/+15
| | | | | | | | | | | | | | Bug: 196081770 Test: bp2build/python_library_conversion_test.go Test: build/bazel/ci/mixed_{libc,droid}.sh Change-Id: I4da9938eb0b039f97b83badd2269af153c7edbcc
* | Add python_library -> py_library bp2build supportAlex Márquez Pérez Muñíz Díaz Púras Thaureaux2021-08-251-0/+60
| | | | | | | | | | | | | | Bug: 196091681 Test: bp2build/python_library_conversion_test.go Test: build/bazel/ci/mixed_{libc,droid}.sh Change-Id: Ice87d75533c97fd9c139dc59de09a039e2713a01
* | Fix inverted error messageAlex Márquez Pérez Muñíz Díaz Púras Thaureaux2021-08-201-1/+1
| | | | | | | | | | | | | | | | | | The code checks to see if the `child` is not a Python library, but then when reporting the error it uses the module name as the dependency name and the child (dependency) as the module name Test: Existing tests pass Change-Id: Ied606342291312d8485a8fd2ddcc580ad24ae82f
* | Don't create a new module for bp2build conversion.Liz Kammer2021-08-171-19/+1
|/ | | | | | | | | | | | | | | | | | | | | | A performance improvement for bp2build as Blueprint/Soong no longer have the overhead of additional modules. The creation of these modules results in: * traversal of additional modules for each subsequent mutator * synchronization over a go channel to collect newly created modules: https://cs.android.com/android/platform/superproject/+/master:build/blueprint/context.go;l=2594,2600;drc=1602226f23181b8c3fbfcaf3358f0297e839d7d3 We avoid both of these by storing the information directly in the underlying module. Also as a fringe benefit, removes some necessary boilerplate for conversion. For benchmarks, reduces runtime ~1% for 1% converted, ~24% for 100% converted. See more: go/benchmarks-for-https:-r.android.com-1792714 Test: ran benchmarks/tests in bp2build Test: build/bazel/ci/bp2build.sh Change-Id: Ie9273b8cbab5bc6edac1728067ce184382feb211
* Merge "Switch python_test_host default to unit_test:true"Julien Desprez2021-05-271-0/+5
|\
| * Switch python_test_host default to unit_test:trueJulien Desprez2021-05-271-0/+5
| | | | | | | | | | | | Test: presubmit Bug: 183730987 Change-Id: Ib54c30c751731aaae8a46af96e809c46469659d1
* | Support blueprint_go_binary in PathForModuleSrcColin Cross2021-05-031-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Allow blueprint_go_binary to be used as test data by supporting it in PathForModuleSrc. Also make python use GetDirectDepsWithTag instead of VisitDirectDeps so it doesn't fail on the dependency to a Blueprint (non-Android) module. Fixes: 186528269 Test: manual Change-Id: Ibc1d7caf7bf1fa5db805c3b885a95df4baee0ecf
* | Mark par_test as not unit testsJulien Desprez2021-04-201-2/+8
| | | | | | | | | | | | | | | | | | They seem to be used as Soong validation. They are not implemented against the python unit tests framework, so we can execute them as such in CI automatically. Change-Id: I8fe662d5d3399d60c8a05acc79b4dd51b5d138a6 Test: presubmit Bug: 183730987
* | Change par file generate rules.yangbill2021-04-192-3/+3
| | | | | | | | | | | | | | | | | | | | | | Make sure the shebang of the par file is consistent with the main python script rather than use /usr/bin/python arbitrarily. Bug: 185399398 Bug: 185094069 Test: m atest ; atest-dev --help m atest-py2 ; atest-py2-dev --help Change-Id: Ice4590b3d173e6d11e608c2ca29b297df0dc4089
* | bp2build: arch-configurable selects for label list attrs.Jingwen Chen2021-03-301-4/+7
|/ | | | | | | This CL adds the configurable LabelListAttribute support to bp2build. Test: go test Change-Id: I2ef9e385d9cf1b1845988128eca1d8cda1ecb5e8
* bp2build: add allowlist for package-level conversions.Jingwen Chen2021-03-241-1/+1
| | | | | | | | | | | | | | | | | This CL adds the support for specifying lists of directories in build/soong/android/bazel.go, which are then written into out/soong/bp2build/MANIFEST. Using this configuration, modules/directories can either default to bp2build_available: true or false, while still retaining the ability to opt-in or out at the module level. It also ensures that ConvertWithBp2Build returns true iff the module type has a registered bp2build converter. Test: go tests Test: demo.sh full Test: TreeHugger presubmits for bp2build and mixed builds. Change-Id: I0e0f6f4b1b2ec045f2f1c338f7084defc5d23a55