aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2022-09-15 16:52:26 -0700
committerCole Faust <colefaust@google.com>2022-09-15 17:04:57 -0700
commit2712506a265138931a5dfa07fb54a30d165a6933 (patch)
tree2d12187d654b571a4fdecb35132d365981ebccc5
parent9e395f7cb998168aa96de5bff5f7d439ff7f683e (diff)
downloadmarkupsafe-2712506a265138931a5dfa07fb54a30d165a6933.tar.gz
Move py-markupsafe 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 markupsafe was being added to the zip file under src/markupsafe, "import markupsafe" works currectly, but won't work after the PYTHONPATH changes (you'd have to say "import src.markupsafe"). To fix this, move the Android.bp file for py-markupsafe 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: I9e2eae397686052404754d4edf5e60c590c3d10b
-rw-r--r--Android.bp17
-rw-r--r--src/Android.bp20
2 files changed, 20 insertions, 17 deletions
diff --git a/Android.bp b/Android.bp
index 451b078..acbba46 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,20 +14,3 @@ license {
"LICENSE.rst",
],
}
-
-python_library {
- name: "py-markupsafe",
- host_supported: true,
- srcs: [
- "src/markupsafe/__init__.py",
- "src/markupsafe/_native.py",
- ],
- version: {
- py2: {
- enabled: true,
- },
- py3: {
- enabled: true,
- },
- },
-}
diff --git a/src/Android.bp b/src/Android.bp
new file mode 100644
index 0000000..828e7eb
--- /dev/null
+++ b/src/Android.bp
@@ -0,0 +1,20 @@
+package {
+ default_applicable_licenses: ["external_python_markupsafe_license"],
+}
+
+python_library {
+ name: "py-markupsafe",
+ host_supported: true,
+ srcs: [
+ "markupsafe/__init__.py",
+ "markupsafe/_native.py",
+ ],
+ version: {
+ py2: {
+ enabled: true,
+ },
+ py3: {
+ enabled: true,
+ },
+ },
+}