Commit Graph

435 Commits

Author SHA1 Message Date
Paul Yang
4dec4f9371
Rebuild python docker image (#5475)
* Rebuild python docker image

* Update docker image

* Change call to build_and_run_docker.sh

* Set up python tests for different versions

* Fix comments
2018-12-18 18:07:24 -08:00
Paul Yang
704037f23a
Change MACOSX_DEPLOYMENT_TARGET to 10.9 (#5406)
* Add kokoro build for python source package

* Use libc++ for xcode 10 (#5303)

The xcode 10 removes the deprecated libstdc++ library. We could set
"MACOSX_DEPLOYMENT_TARGET" to "10.9" to use libc++ instead.

* Add python 3.7 build

* Add build for python 3.7 on linux and windows

* Remove unused source build

* Add comment

* Fix $MACOSX_DEPLOYMENT_TARGET mismatch

* Fix MACOSX_DEPLOYMENT_TARGET mismatch

* Add missing import for sysconfig

* Add missing imports
2018-11-28 16:45:16 -08:00
giokara-oqton
f22be4ddb0 fix json_format.ParseDict modifies input (#5267)
* fix json_format.ParseDict modifies input

* added unit test

* fix naming
2018-11-26 11:08:54 -08:00
Adam Cozzette
0894e07536 Integrated internal changes from Google 2018-11-09 11:28:22 -08:00
Leon Barrett
9e69594adf Fix parsing empty Struct Values from Json (#5211)
* Fix parsing empty Struct Values from Json

This fixes a bug. When parsing a struct from JSON like
    struct = json_format.Parse('{"k": {}}', Struct())
then the struct's "k" value would end up not initialized, and accessing
the value would raise an error.
    In[1]: struct['k']
    ValueError: Value not set
That seems to be because the Struct field of the Value was not set.
    In[2]: struct
    Out[2]:
    fields {
      key: "k"
      value {
      }
    }

This commit makes sure that the Value's Struct field is initialized even
if the Struct has no values itself.

This commit also extends a test to cover this case.

* Additionally test for empty list
2018-10-05 16:38:16 -07:00
Josh Kelley
8d6f8df1ec ParseFromString returns bytes parsed (#5166)
* ParseFromString returns bytes parsed

ParseFromString is documented as returning the number of bytes parsed,
and the C++ implementation does this, so the Python implementation
should too.

See #5165.

* Fix docstring

* Add a test for ParseFromString length behavior
2018-10-05 11:07:55 -07:00
Kevin James
f50a1f843e fix(python): fix deprecated collections.abc usage (#5195)
Many classes within collections were moved to collections.abc in Python
3.3 -- their usage as imported directly from collections is now
deprecated as of Python 3.7 and will be removed soon.

The fallback import added in this PR can be removed entirely when
support for versions of Python prior to 3.3 is dropped.
2018-10-04 16:06:53 -07:00
Benjamin Peterson
188c44b117 Remove 2to3 code from setup.py. (#5114)
Python protobuf has long been a single-source codebase. 2to3 shouldn't need to run in setup.py.
2018-09-10 13:35:38 -07:00
Josh Haberman
e53be9bce4 Fixed Python extension compile. 2018-09-07 13:07:20 -07:00
Josh Haberman
986fad3eb1 Removed obsolete hash_map header that was breaking the compile. 2018-09-07 11:20:04 -07:00
Josh Haberman
d61aede89c Down-integrate from google3. 2018-09-04 10:58:54 -07:00
Feng Xiao
afe98de32a Replace repo links. 2018-08-22 11:55:30 -07:00
Jie Luo
ab09b2a2e2
Disable surrogate check for ucs2 (#5039)
* _SURROGATE_PATTERN check for ucs4
Skip some test for ucs2 by sys.maxunicode
2018-08-14 11:17:16 -07:00
Feng Xiao
14be563f00 Down-integrate proto2 namespace fix. 2018-08-13 12:32:21 -07:00
Feng Xiao
acd5b05e9f Fix failing tests.
1. Fix C++ tests.
  * Add missing files to Makefile.am and fix distcheck in tests.sh
  * Remove BUILT_SOURCES from conformance/Makefile.am.
  * Add some missing override keyword.
  * Add a type cast to int64 because our StrCat() in stubs can't handle size_t.
2. Fix Java tests.
  * Add missing test dependency on guava in pom.xml.
  * Include newly referenced test data in test resources.
  * Manually fix map_lite_test.proto which is overwritten because it's mapped
    from map_test.proto in google3.
  * Add back "optimize_for = LITE_RUNTIME" which is still needed to keep the
    opensource test passing as it's still running lite tests.
  * Add a type cast in newBuilder() because without it the code doesn't compile
    with openjdk javac 1.8 (the compiler can't figure if it's the right type
    due to complex generic typing).
3. Fix Python tests.
  * Remove/replace references to <hash_map>.
  * Suppress more warnings in setup.py.
  * Replace incorrect header inclusion for google/protobuf/proto_api.h.
  * Add strings::EndsWith to google/protobuf/stubs/strutil.h because it's
    referenced in the updated python C extension code.
  * Replace proto2 with google::protobuf. The proto2 name is leaked to
    opensource because we removed the subsitition rule for proto2 namespace
    but only fixed C++ source code and forgot to update python C extension code.
2018-08-09 21:21:01 -07:00
Feng Xiao
a8465b738e Merge master branch. 2018-08-08 17:14:42 -07:00
Feng Xiao
6bbe197e9c Down-integrate from google3. 2018-08-08 17:00:41 -07:00
Adam Cozzette
94d55e5292 Merge branch '3.6.x' into merge-3-6-x 2018-08-01 13:44:55 -07:00
Adam Cozzette
9e1286b949 Updated version numbers to 3.6.1 2018-07-27 13:30:28 -07:00
Arun Olappamanna Vasudevan
c7e0e262a6 pyext needs c++11 in linux and mac. (#4930) 2018-07-23 13:35:15 -07:00
Feng Xiao
2dcd6ae409
Remove/replace travis references (#4953)
* Remove/replace travis references.
2018-07-22 17:14:24 -07:00
Yilun Chong
359889bafd fix python cpp kokoro build 2018-07-15 21:01:48 -07:00
Yilun Chong
14bc658175 fix python cpp kokoro build 2018-07-12 16:49:26 -07:00
Ben Webb
0a59054c30 Add Python 3.7 compatibility (#4862)
Compilation of Python wrappers fails with Python 3.7 because
the Python folks changed their C API such that
PyUnicode_AsUTF8AndSize() now returns a const char* rather
than a char*. Add a patch to work around. Relates #4086.
2018-07-12 10:58:10 -07:00
Thomas Colthurst
79700b56b9 Update message_module.cc (#4835)
* Update message_module.cc

Add missing piece from pull request #4698:  actually initialize the new API object.

* Update message_module.cc
2018-07-03 13:52:27 -07:00
Thomas Colthurst
1ae2cc02b6 Fix capsule name. (#4836)
Internal convert file was broken. Change the capsule to the correct name
2018-06-29 11:07:29 -07:00
Adam Cozzette
d6f346b4d5
Merge pull request #4827 from acozzette/merge-3-6-x
Merge 3.6.x branch into master
2018-06-25 15:52:29 -07:00
Yuchen Xie
595231dd5c Update minimal Python version to 2.7 (#4207) 2018-06-25 15:20:53 -07:00
Adam Cozzette
82d3d7d250 Merge branch '3.6.x' into merge-3-6-x 2018-06-25 13:22:10 -07:00
cclauss
35567c1668 global __version__ In setup.py (#4753)
This change helps both humans and linters to understand the unusual method of instantiating this global variable.
2018-06-25 10:50:40 -07:00
cclauss
35c6927cc1 import inspect (#3507)
Inspect is used five times on line 65-74 without being imported.
2018-06-11 14:17:46 -07:00
Thomas Colthurst
7c6514245b Introduce Proto C API; based on cl/198113115 by amauryfa 2018-05-30 10:33:02 -04:00
Paul Yang
6f723a6624
Always add -std=c++11 for mac (#4684) 2018-05-25 14:42:41 -07:00
Jisi Liu
45eb28b588 Update version number to 3.6.0 2018-05-14 16:06:22 -07:00
Yilun Chong
4a09836e6c Fix python ext build on kokoro (#4527) 2018-05-03 15:55:27 -07:00
Thomas Hisch
451e0446ab 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.
2018-04-09 12:43:10 -07:00
Paul Yang
3b6d027ba2
For windows, all python version should use /MT (#4468) 2018-04-06 15:43:32 -07:00
Paul Yang
c931743461
Merge branch (#4466)
* Fix setup.py for windows build.

* Bump version number to 3.5.2

* Cat the test-suite.log on errors for presubits
2018-04-02 15:55:28 -07:00
Adam Cozzette
11d26ce24c Removed unused variables in repeated_scalar_container.cc 2018-03-20 14:44:30 -07:00
Adam Cozzette
8b3a72f3e9 Removed unused code pertaining to shared_ptr 2018-03-20 14:44:30 -07:00
Adam Cozzette
c5fcce5f69 Added pyext/thread_unsafe_shared_ptr.h 2018-03-20 13:02:18 -07:00
Adam Cozzette
3fa5dadb61 Removed unrecognized option from no_package.proto 2018-03-20 13:02:18 -07:00
Adam Cozzette
837c94b86f Include no_package.proto in Python test 2018-03-14 13:11:32 -07:00
Adam Cozzette
afe96b6d42 Merge branch 'master' into down-integrate 2018-03-13 16:54:31 -07:00
Adam Cozzette
0400cca323 Integrated internal changes from Google 2018-03-13 16:37:29 -07:00
Jie Luo
e34ec6077a
Only check filenames when end with .py in _CalledFromGeneratedFile() (#4262)
* Cython's stack does not have .py file name. Only check filenames when end with .py for _CalledFromGeneratedFile()
2018-02-09 15:54:03 -08:00
Jisi Liu
ec826c5a59 Merge remote-tracking branch 'origin/3.5.x' into master 2018-01-03 09:28:58 -08:00
Jisi Liu
383a4941d5 Merge remote-tracking branch 'origin/3.5.x' into master 2018-01-03 09:28:40 -08:00
Jisi Liu
8fc40b5502 Fix uploading binary wheel.
The script now takes two prompt for user name and password. One single
input redirection no longer works.
2017-12-22 12:05:37 -08:00
Jisi Liu
7ad8e7ad59 Disable pip cache when testing uploaded packages
Otherwise, pip complains "cannot find a version satisfies the
requirement." I suspect it was due to caching issues. I usued to
manually add a `sleep 30` between the upload and the installation test
which is quite unstable.
2017-12-22 11:47:13 -08:00
Feng Xiao
a5b743f8ae
Merge pull request #4030 from cyyber/master
Calling Keychecker before checking key in MessageMap
2017-12-20 12:07:46 -08:00
Jisi Liu
050fc9a437 Update version number to 3.5.1 2017-12-19 11:00:33 -08:00
Feng Xiao
3a06fe1fc9 Fix file permission for python package.
`umask 0022` makes sure the created package will be accessible by all users.
2017-12-15 12:57:26 -08:00
Feng Xiao
77d32bc56c
Merge pull request #4053 from xfxyjwf/fixumask
Fix file permission for python package.
2017-12-15 12:09:19 -08:00
Feng Xiao
0fc85acdf2 Fix file permission for python package.
`umask 0022` makes sure the created package will be accessible by all users.
2017-12-14 17:54:18 -08:00
cyyber
0e2089c775 Calling Keychecker before checking key in MessageMap 2017-12-15 01:01:31 +05:30
Jisi Liu
acadade56e Remove py2.6 support. 2017-12-14 11:26:58 -08:00
Jisi Liu
594ec2262c Fix python descriptor test. 2017-12-14 11:16:34 -08:00
Adam Cozzette
0ba8eea655 Merge branch 'master' into down-integrate 2017-12-01 10:05:19 -08:00
Adam Cozzette
92a7e778e7 Integrated internal changes from Google 2017-12-01 10:05:10 -08:00
Adam Cozzette
a27da09339 Merge branch '3.5.x' into 3.5.x-merge 2017-11-30 13:34:51 -08:00
Jisi Liu
cf65a7946f Update version for 3.5.0.post1 2017-11-22 14:05:10 -08:00
Jie Luo
45d99a15f3
Add _file_desc_by_toplevel_extension back
Add _file_desc_by_toplevel_extension back for compatibility issue with 3.4.1.

_file_desc_by_toplevel_extension is a temporary solution for FieldDescriptor.file.
FieldDescriptor.file was added in code gen. However, we need to keep it for some time for compatibility reason (with 3.4.1 only). May try to remove it after 2 years.
2017-11-22 13:59:11 -08:00
Paul Kilgo
9935829a66 Include .cc and .h files in source distribution 2017-11-17 15:30:31 -08:00
Jisi Liu
97dd175a91 Update version number to 3.5.0 2017-11-02 14:16:22 -07:00
Roman Nekhoroshev
da3bfa693a
Fix a typo in WKT's test suite
Hi!
Sorry for bothering with such a minor thing, but I just noticed and fixed one annoying typo in WKT's test suite:
`"accpets" -> "accepts"`

Thanks!
2017-11-02 13:47:11 -07:00
Jisi Liu
07b9238a1c Merge pull request #3770 from pherl/3.5-integrate
Integrate google internal changes for the up coming 3.5 release.
2017-10-19 10:48:54 -07:00
Jisi Liu
30bfe36b6a Merge pull request #3736 from jleni/fix_rbpi
Fix: Truncated Message due to "TypeError: unhashable type: 'bytearray'"
2017-10-18 12:56:04 -07:00
Jisi Liu
1a7a7fca80 Merge from google internal 2017-10-18 12:22:18 -07:00
Jisi Liu
de15e73d58 Merge remote-tracking branch 'origin/3.4.x' into master 2017-10-11 14:44:03 -07:00
Juan Leni
08334f0908 Converting to immutable hashable types 2017-10-11 06:46:25 +02:00
Jisi Liu
dba647a6b2 Bump version for minor release 2017-09-14 11:12:55 -07:00
Adam Cozzette
13fd045dbb Integrated internal changes from Google 2017-09-14 10:03:57 -07:00
Feng Xiao
2ad5c0a864 Merge pull request #2576 from cristicbz/py-strutil
python: do not include internal 'strutil.h' header
2017-09-08 10:23:14 -07:00
Jie Luo
610e433888 Drop python2.6
Jenkins complains for python 2.6
DEPRECATION: Python 2.6 is no longer supported by the Python core team
ERROR: InvocationError: '/tmp/protobuf/protobuf/python/.tox/py26-cpp/bin/python setup.py -q build_py'
https://grpc-testing.appspot.com/job/protobuf_pull_request/1502/testReport/junit/(root)/python_cpp/python_cpp/
2017-08-22 16:39:26 -07:00
Jie Luo
028d6f13ee Add Python 3.5 3.6 2017-08-22 15:59:27 -07:00
Jisi Liu
ba4e54724d Merge pull request #3529 from pherl/merge3.4.x
Merge 3.4.x into master
2017-08-21 10:39:27 -07:00
cclauss
472f700884 remove the parens from the cmp() lambda definition (#3526)
* remove the parens from the cmp() lambda definition

https://github.com/PythonCharmers/python-future/pull/298

* remove the parens from the cmp() lambda definition

https://github.com/PythonCharmers/python-future/pull/298
2017-08-21 10:21:11 -07:00
Jisi Liu
139775ccc0 Merge remote-tracking branch 'origin/3.4.x' into mergemaster 2017-08-18 16:25:35 -07:00
Jisi Liu
fdb5cd5e4b Merge pull request #3504 from pherl/3.4.x
Prefer system distributed binaries/libraries.
2017-08-18 16:19:45 -07:00
Jie Luo
c2aa26e507 Revert "Drop Python 3.3 from testing & add Python 3.5, 3.6 (#3512)" (#3524)
This reverts commit 703f414ca6.
2017-08-18 13:15:06 -07:00
cclauss
703f414ca6 Drop Python 3.3 from testing & add Python 3.5, 3.6 (#3512)
* Drop Python 3.3 from testing & add Python 3.5, 3.6

Python 3.3 goes [EOL](https://docs.python.org/devguide/index.html#branchstatus) next month.

* Sync test.sh with the Python versions in tox.ini
2017-08-18 10:14:00 -07:00
cclauss
a04eb8c191 Define cmp() for Python 3 (#3517)
* Define cmp() for Python 3

http://python-future.org/compatible_idioms.html?highlight=cmp#cmp

* Define cmp() for Python 3

http://python-future.org/compatible_idioms.html?highlight=cmp#cmp
2017-08-18 10:13:10 -07:00
cclauss
dded80f924 define long() for Python 3 2017-08-18 01:41:27 +02:00
cclauss
958412e2e6 Old style exception --> new style exception 2017-08-17 19:25:39 +02:00
Jisi Liu
98c6d04df4 Prefer system distributed binaries/libraries.
It seems like the image has a /usr/local/bin/autoconf installed, which
doesn't recognize/work with the yum installed libtools. Putting
distributed binaries/libraries first solves the problem
2017-08-16 13:34:14 -07:00
Jisi Liu
5d5df84913 clean up 2017-08-16 10:35:00 -07:00
Jisi Liu
19a7e2099b Update testpypi addresses.
The old one is deprecated and no longer working.
2017-08-16 10:30:38 -07:00
Jie Luo
f5817b3056 PY26 tests compatibility
1, Some tests in reflection_test PY26 raise TypeError but other versions raise ValueError for convert negative long to unsigned
2, Change compare exception type to compare exception str for testDuplicateExtensionNumber. Original code raise 'Double registration of Extensions' is not an instance of (<type 'exceptions.AssertionError'>, <type 'exceptions.ValueError'>) for PY26 cpp implementation

t
2017-08-04 15:25:11 -07:00
Jie Luo
9150cd8603 Skip setUpClass which is newly added in python2.7 for python2.6 2017-08-04 10:50:24 -07:00
Jisi Liu
759245a49a Merge from master 2017-07-25 11:52:33 -07:00
Jisi Liu
ce4416705b Merge remote-tracking branch 'origin/3.4.x' into vb 2017-07-24 20:44:59 -07:00
Jie Luo
9c012ed07d Add __bool__ as well as __nonzero__ for python3 2017-07-24 16:42:23 -07:00
Jisi Liu
7bb39bef1a Update version number for 3.4.0 2017-07-24 16:03:49 -07:00
Jie Luo
a484794820 Use keys() instead of iterkeys() to be python3 compatbile. 2017-07-24 15:44:16 -07:00
Yilun Chong
a713b73076 Merge pull request #3281 from BSBandme/ConformanceTestYilunChong
Proto2 test message support to conformance test
2017-07-24 14:50:52 -07:00
Feng Xiao
062df3d072 Merge pull request #3179 from bjwatson/fix-duration-typo
Fix typos in comment
2017-07-20 13:01:04 -07:00
Jie Luo
bba4c4ae51 Merge pull request #3262 from snnn/master
Make it compatible with python 3.6.1
2017-07-19 16:25:05 -07:00
Jisi Liu
dd091aad48 Fix code to use values() instead 2017-07-19 15:00:19 -07:00
Jisi Liu
b07cdb6e8e Use itmes() instead of itervalues() to be python3 compatbile. 2017-07-19 13:55:58 -07:00