Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workarounds for loading mke2fs.conf with bazel-built apexer
There are a couple issues when running pkgutil.get_data('apexer', 'mke2fs.conf') from a bazel-built apexer binary: - Soong will take the path to mke2fs.conf as being relative to the filegroup that included it, so mke2fs.conf ends up at the root of the python zip file, and next to apexer.py. Bazel doesn't do this, and instead keeps the mke2fs.conf file under a system/extras/ext4_utils folder. Use a genrule to explicitly copy mke2fs.conf to the current directory to work around this issue. - pkgutil.get_data() uses python's normal rules for locating modules in order to find where the file is. This means it will look through sys.path again to find the apexer module. Bazel currently has a bug where the first entry in sys.path is the location of apexer.py in the source tree, not in the runfiles directory. So pkgutil will find apexer.py there, and then start looking for mke2fs.conf next to it, and not find it. Work around this by deleting sys.path[0]. bazelbuild/rules_python#382 Bug: 204244290 Test: Presubmits Change-Id: I9fb9502bff2590abfde95f7f7cc9ebf31157836d
- Loading branch information