aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2022-09-14 15:53:19 -0700
committerCole Faust <colefaust@google.com>2022-09-14 15:53:19 -0700
commitfec05151949645a5b3b17f822221b298f11c5660 (patch)
tree2bca6eab73099db857f6d0e7ddb004f719f2c36f
parentac0a22bba99f30f293e664c55387cb05772786d1 (diff)
downloadjinja-fec05151949645a5b3b17f822221b298f11c5660.tar.gz
Move py-jinja to src foldermain-16k
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
-rw-r--r--Android.bp18
-rw-r--r--src/Android.bp13
2 files changed, 13 insertions, 18 deletions
diff --git a/Android.bp b/Android.bp
index a79f39a..6bfae8d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,21 +14,3 @@ license {
"LICENSE.rst",
],
}
-
-python_library {
- name: "py-jinja",
- host_supported: true,
- srcs: ["src/jinja2/*.py"],
- libs: [
- "py-markupsafe",
- "py-setuptools",
- ],
- version: {
- py2: {
- enabled: false,
- },
- py3: {
- enabled: true,
- },
- },
-}
diff --git a/src/Android.bp b/src/Android.bp
new file mode 100644
index 0000000..e8a5e50
--- /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",
+ ],
+}