aboutsummaryrefslogtreecommitdiffhomepage
path: root/python/setup.py
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2015-08-25 20:24:43 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2015-08-25 20:24:43 -0700
commitb192ba87f72b5e3e8add09bbcbb7623831e3079b (patch)
treeaffb3beff3c33050e7f93647ddab8606899ff03d /python/setup.py
parent5da0b46811a103bd1a953f496d4bcd5ff45d3736 (diff)
parentcf94f7b74495d08b833056016e045a0ae3fb64fa (diff)
Merge remote-tracking branch 'origin/master' into beta-1
Diffstat (limited to 'python/setup.py')
-rwxr-xr-xpython/setup.py53
1 files changed, 22 insertions, 31 deletions
diff --git a/python/setup.py b/python/setup.py
index 78b43c20..8269c4a5 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -8,19 +8,7 @@ import sys
# We must use setuptools, not distutils, because we need to use the
# namespace_packages option for the "google" package.
-try:
- from setuptools import setup, Extension, find_packages
-except ImportError:
- try:
- from ez_setup import use_setuptools
- use_setuptools()
- from setuptools import setup, Extension, find_packages
- except ImportError:
- sys.stderr.write(
- "Could not import setuptools; make sure you have setuptools or "
- "ez_setup installed.\n"
- )
- raise
+from setuptools import setup, Extension, find_packages
from distutils.command.clean import clean as _clean
@@ -79,16 +67,14 @@ def generate_proto(source, require = True):
if protoc is None:
sys.stderr.write(
- "protoc is not installed nor found in ../src. "
- "Please compile it or install the binary package.\n"
- )
+ "protoc is not installed nor found in ../src. Please compile it "
+ "or install the binary package.\n")
sys.exit(-1)
- protoc_command = [protoc, "-I../src", "-I.", "--python_out=.", source]
+ protoc_command = [ protoc, "-I../src", "-I.", "--python_out=.", source ]
if subprocess.call(protoc_command) != 0:
sys.exit(-1)
-
def GenerateUnittestProtos():
generate_proto("../src/google/protobuf/map_unittest.proto", False)
generate_proto("../src/google/protobuf/unittest_arena.proto", False)
@@ -125,13 +111,12 @@ 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'):
+ filepath.endswith(".so") or filepath.endswith(".o") or \
+ filepath.endswith('google/protobuf/compiler/__init__.py'):
os.remove(filepath)
# _clean is an old-style class, so super() doesn't work.
_clean.run(self)
-
class build_py(_build_py):
def run(self):
# Generate necessary .proto file if it doesn't exist.
@@ -147,13 +132,7 @@ class build_py(_build_py):
pass
# _build_py is an old-style class, so super() doesn't work.
_build_py.run(self)
- # TODO(mrovner): Subclass to run 2to3 on some files only.
- # Tracing what https://wiki.python.org/moin/PortingPythonToPy3k's
- # "Approach 2" section on how to get 2to3 to run on source files during
- # install under Python 3. This class seems like a good place to put logic
- # that calls python3's distutils.util.run_2to3 on the subset of the files we
- # have in our release that are subject to conversion.
- # See code reference in previous code review.
+
if __name__ == '__main__':
ext_module_list = []
@@ -173,6 +152,12 @@ if __name__ == '__main__':
)
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
+ # Keep this list of dependencies in sync with tox.ini.
+ install_requires = ['six', 'setuptools']
+ if sys.version_info <= (2,7):
+ install_requires.append('ordereddict')
+ install_requires.append('unittest2')
+
setup(
name='protobuf',
version=GetVersion(),
@@ -183,8 +168,14 @@ if __name__ == '__main__':
maintainer_email='protobuf@googlegroups.com',
license='New BSD License',
classifiers=[
- 'Programming Language :: Python :: 2.7',
- ],
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 2",
+ "Programming Language :: Python :: 2.6",
+ "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.3",
+ "Programming Language :: Python :: 3.4",
+ ],
namespace_packages=['google'],
packages=find_packages(
exclude=[
@@ -196,6 +187,6 @@ if __name__ == '__main__':
'clean': clean,
'build_py': build_py,
},
- install_requires=['setuptools'],
+ install_requires=install_requires,
ext_modules=ext_module_list,
)