aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorThomas Hisch <t.hisch@gmail.com>2018-04-09 21:43:10 +0200
committerJie Luo <anandolee@gmail.com>2018-04-09 12:43:10 -0700
commit451e0446abc40f46b5941c3feedb111e920c9959 (patch)
tree836e5a8f428cefd6c818404cf659520783eb82f6 /python
parent3b6d027ba250c96ac1c5e3c0a1de0b1570d7bba1 (diff)
downloadprotobuf-451e0446abc40f46b5941c3feedb111e920c9959.tar.gz
protobuf-451e0446abc40f46b5941c3feedb111e920c9959.tar.bz2
protobuf-451e0446abc40f46b5941c3feedb111e920c9959.zip
Add __init__.py files to compiler and util subpackages (#4117)
The compiler and util subpackages are created by the build_py class in setup.py. This has caused an issue in the protobuf package in conda-forge (https://github.com/conda-forge/protobuf-feedstock/issues/40), which is fixed by this commit.
Diffstat (limited to 'python')
-rw-r--r--python/google/protobuf/compiler/__init__.py0
-rw-r--r--python/google/protobuf/util/__init__.py0
-rwxr-xr-xpython/setup.py10
3 files changed, 1 insertions, 9 deletions
diff --git a/python/google/protobuf/compiler/__init__.py b/python/google/protobuf/compiler/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/python/google/protobuf/compiler/__init__.py
diff --git a/python/google/protobuf/util/__init__.py b/python/google/protobuf/util/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/python/google/protobuf/util/__init__.py
diff --git a/python/setup.py b/python/setup.py
index 8f1caec2..bdae6913 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -120,9 +120,7 @@ class clean(_clean):
for filename in filenames:
filepath = os.path.join(dirpath, filename)
if filepath.endswith("_pb2.py") or filepath.endswith(".pyc") or \
- filepath.endswith(".so") or filepath.endswith(".o") or \
- filepath.endswith('google/protobuf/compiler/__init__.py') or \
- filepath.endswith('google/protobuf/util/__init__.py'):
+ filepath.endswith(".so") or filepath.endswith(".o"):
os.remove(filepath)
# _clean is an old-style class, so super() doesn't work.
_clean.run(self)
@@ -144,12 +142,6 @@ class build_py(_build_py):
generate_proto("../src/google/protobuf/wrappers.proto")
GenerateUnittestProtos()
- # Make sure google.protobuf/** are valid packages.
- for path in ['', 'internal/', 'compiler/', 'pyext/', 'util/']:
- try:
- open('google/protobuf/%s__init__.py' % path, 'a').close()
- except EnvironmentError:
- pass
# _build_py is an old-style class, so super() doesn't work.
_build_py.run(self)