From fec05151949645a5b3b17f822221b298f11c5660 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Wed, 14 Sep 2022 15:53:19 -0700 Subject: Move py-jinja to src folder When soong packages python files into a zip file, it will take their path relative to the Android.bp file and preserve that relative path in the zip file. Then the root directory of the zip file is added to the PYTHONPATH. Currently, all subdirectories of the top level zip directory are also added to the PYTHONPATH, but we want to remove this. Since jinja was being added to the zip file under src/jinja2, "import jinja2" works currectly, but won't work after the PYTHONPATH changes (you'd have to say "import src.jinja2"). To fix this, move the Android.bp file for py-jinja into the src folder, so the relative paths don't contain src/. Soong python modules do have a pkg_path attribute, which essentially adds more folders to the relative path, but we would need an attribute that removes them, which doesn't exist. This could also be done with a filegroup with the "path" attribute, but bp2build doesn't support that, so I opted to go with this option instead. Bug: 245583294 Test: Presubmits Change-Id: I38247f1f7e0a21d2f4f91ff3fc3c04e02ad52954 --- src/Android.bp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Android.bp (limited to 'src/Android.bp') diff --git a/src/Android.bp b/src/Android.bp new file mode 100644 index 00000000..e8a5e504 --- /dev/null +++ b/src/Android.bp @@ -0,0 +1,13 @@ +package { + default_applicable_licenses: ["external_python_jinja_license"], +} + +python_library { + name: "py-jinja", + host_supported: true, + srcs: ["jinja2/*.py"], + libs: [ + "py-markupsafe", + "py-setuptools", + ], +} -- cgit v1.2.3