<Hermetic> Implement CPython2 Launcher in C++.
The launcher is actually a wrapper which will statically link Python
interpreter within the .par file. It is used to bootstrap embedded
interpreter.
The next step is to change/integrate with Soong to make this hermetic .par
generation process more automatic.
Bug: b/62380596
Test: The launcher has been tested using real files:
zip -r hermetic.zip entry_point.txt Stdlib/ runfiles/
cat launcher | cat - hermetic.zip > executable && chmod u+x executable
Change-Id: I293cae2fe74d46766044f3e3c4b654a54d319b67
diff --git a/Lib/Android.bp b/Lib/Android.bp
new file mode 100644
index 0000000..55971a3
--- /dev/null
+++ b/Lib/Android.bp
@@ -0,0 +1,64 @@
+// Copyright 2017 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+python_library_host {
+ name: "py2-stdlib",
+ is_internal: true,
+ pkg_path: "stdlib",
+ srcs: [
+ "*.py",
+ "compiler/**/*.py",
+ "email/**/*.py",
+ "encodings/**/*.py",
+ "hotshot/**/*.py",
+ "importlib/**/*.py",
+ "json/**/*.py",
+ "logging/**/*.py",
+ "multiprocessing/**/*.py",
+ "pydoc_data/**/*.py",
+ "unittest/**/*.py",
+ "wsgiref/**/*.py",
+ "xml/**/*.py",
+ ],
+ // TODO(nanzhang): make exclude_srcs support globs.
+ exclude_srcs: [
+ "__phello__.foo.py",
+ ],
+ version: {
+ py2: {
+ enabled: true,
+ },
+ py3: {
+ enabled: false,
+ },
+ },
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ linux_x86_64: {
+ srcs: [
+ ":py2-plat-linux2",
+ ],
+ },
+ },
+}
+
+filegroup {
+ name: "py2-plat-linux2",
+ srcs: [
+ "plat-linux2/*.py",
+ ],
+ path: "plat-linux2",
+}