py-protobuf package: fix import error for Python 2.x (#12873)

This commit is contained in:
Sinan 2019-09-20 17:52:11 -07:00 committed by Peter Scheibel
parent 5397606b34
commit af8f245f48

View File

@ -42,3 +42,11 @@ def build_args(self, spec, prefix):
def install_args(self, spec, prefix):
args = super(PyProtobuf, self).install_args(spec, prefix)
return args + ['--cpp_implementation']
@run_after('install')
def fix_import_error(self):
if str(self.spec['python'].version.up_to(1)) == '2':
touch = which('touch')
touch(self.prefix + '/' +
self.spec['python'].package.site_packages_dir +
'/google/__init__.py')