فهرست منبع

Merge pull request #50 from dlitz/compat-py3k

setup.py fixes for Python 3
Feng Xiao 11 سال پیش
والد
کامیت
ad7f41bd57
1فایلهای تغییر یافته به همراه11 افزوده شده و 2 حذف شده
  1. 11 2
      python/setup.py

+ 11 - 2
python/setup.py

@@ -20,7 +20,12 @@ except ImportError:
         "ez_setup installed.\n")
     raise
 from distutils.command.clean import clean as _clean
-from distutils.command.build_py import build_py as _build_py
+if sys.version_info[0] >= 3:
+    # Python 3
+    from distutils.command.build_py import build_py_2to3 as _build_py
+else:
+    # Python 2
+    from distutils.command.build_py import build_py as _build_py
 from distutils.spawn import find_executable
 
 maintainer_email = "protobuf@googlegroups.com"
@@ -189,7 +194,11 @@ if __name__ == '__main__':
           'google.protobuf.text_format'],
         cmdclass = { 'clean': clean, 'build_py': build_py },
         install_requires = ['setuptools'],
-        setup_requires = ['google-apputils'],
+        # TODO: Restore dependency once a Python 3 compatible google-apputils
+        # is released.
+        setup_requires = (['google-apputils']
+                          if sys.version_info[0] < 3 else
+                          []),
         ext_modules = ext_module_list,
         url = 'https://developers.google.com/protocol-buffers/',
         maintainer = maintainer_email,