~ubuntu-branches/ubuntu/trusty/protobuf/trusty-proposed

« back to all changes in this revision

Viewing changes to python/setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-05-31 14:41:47 UTC
  • mfrom: (2.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110531144147-s41g5fozgvyo462l
Tags: 2.4.0a-2ubuntu1
* Merge with Debian; remaining changes:
  - Fix linking with -lpthread.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
from ez_setup import use_setuptools
8
8
use_setuptools()
9
9
 
10
 
from setuptools import setup
 
10
from setuptools import setup, Extension
11
11
from distutils.spawn import find_executable
12
12
import sys
13
13
import os
20
20
  protoc = "../src/protoc"
21
21
elif os.path.exists("../src/protoc.exe"):
22
22
  protoc = "../src/protoc.exe"
 
23
elif os.path.exists("../vsprojects/Debug/protoc.exe"):
 
24
  protoc = "../vsprojects/Debug/protoc.exe"
 
25
elif os.path.exists("../vsprojects/Release/protoc.exe"):
 
26
  protoc = "../vsprojects/Release/protoc.exe"
23
27
else:
24
28
  protoc = find_executable("protoc")
25
29
 
56
60
    del sys.modules['google']
57
61
 
58
62
  generate_proto("../src/google/protobuf/unittest.proto")
 
63
  generate_proto("../src/google/protobuf/unittest_custom_options.proto")
59
64
  generate_proto("../src/google/protobuf/unittest_import.proto")
60
65
  generate_proto("../src/google/protobuf/unittest_mset.proto")
61
66
  generate_proto("../src/google/protobuf/unittest_no_generic_services.proto")
90
95
    for (dirpath, dirnames, filenames) in os.walk("."):
91
96
      for filename in filenames:
92
97
        filepath = os.path.join(dirpath, filename)
93
 
        if filepath.endswith("_pb2.py") or filepath.endswith(".pyc"):
 
98
        if filepath.endswith("_pb2.py") or filepath.endswith(".pyc") or \
 
99
          filepath.endswith(".so") or filepath.endswith(".o"):
94
100
          os.remove(filepath)
95
101
  else:
96
102
    # Generate necessary .proto file if it doesn't exist.
97
103
    # TODO(kenton):  Maybe we should hook this into a distutils command?
98
104
    generate_proto("../src/google/protobuf/descriptor.proto")
 
105
    generate_proto("../src/google/protobuf/compiler/plugin.proto")
 
106
 
 
107
  ext_module_list = []
 
108
 
 
109
  # C++ implementation extension
 
110
  if os.getenv("PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION", "python") == "cpp":
 
111
    print "Using EXPERIMENTAL C++ Implmenetation."
 
112
    ext_module_list.append(Extension(
 
113
        "google.protobuf.internal._net_proto2___python",
 
114
        [ "google/protobuf/pyext/python_descriptor.cc",
 
115
          "google/protobuf/pyext/python_protobuf.cc",
 
116
          "google/protobuf/pyext/python-proto2.cc" ],
 
117
        include_dirs = [ "../src", ".", ],
 
118
        libraries = [ "protobuf" ],
 
119
        runtime_library_dirs = [ "../src/.libs" ],
 
120
        library_dirs = [ "../src/.libs" ]))
99
121
 
100
122
  setup(name = 'protobuf',
101
 
        version = '2.3.0',
 
123
        version = '2.4.0a',
102
124
        packages = [ 'google' ],
103
125
        namespace_packages = [ 'google' ],
104
126
        test_suite = 'setup.MakeTestSuite',
105
127
        # Must list modules explicitly so that we don't install tests.
106
128
        py_modules = [
 
129
          'google.protobuf.internal.api_implementation',
107
130
          'google.protobuf.internal.containers',
 
131
          'google.protobuf.internal.cpp_message',
108
132
          'google.protobuf.internal.decoder',
109
133
          'google.protobuf.internal.encoder',
110
134
          'google.protobuf.internal.message_listener',
 
135
          'google.protobuf.internal.python_message',
111
136
          'google.protobuf.internal.type_checkers',
112
137
          'google.protobuf.internal.wire_format',
113
138
          'google.protobuf.descriptor',
114
139
          'google.protobuf.descriptor_pb2',
 
140
          'google.protobuf.compiler.plugin_pb2',
115
141
          'google.protobuf.message',
116
142
          'google.protobuf.reflection',
117
143
          'google.protobuf.service',
118
144
          'google.protobuf.service_reflection',
119
145
          'google.protobuf.text_format' ],
 
146
        ext_modules = ext_module_list,
120
147
        url = 'http://code.google.com/p/protobuf/',
121
148
        maintainer = maintainer_email,
122
149
        maintainer_email = 'protobuf@googlegroups.com',