Commit Graph

136 Commits

Author SHA1 Message Date
Jan Tattermusch
f4360f0a89 reintroduce setup.py changes from #8280 erased by piper import #8617 2021-06-18 12:38:47 +02:00
Thomas BACCELLI
26c0fbc15b Add macOS big sur compatibility 2020-12-07 14:36:56 -08:00
Misha Seltzer
7daf0aa7b0 Removed the unnecessary setuptools package dependency for Python package.
The setuptools package was added to allow definition of namespaces using
the now outdated (and discouraged from use) pkg_resources-style.

The code here, for a long while now, uses a try/except (`ImportError`)
protection around the setuptools code, and falls back to the more
encoraged pkgutil-style.

Removing this library won't affect any current workflow, and in the case
of setuptools not found, it'll actually use a more modern (and
encouraged) flow.
2020-10-12 17:27:33 -07:00
Fabrice Fontaine
3abbbd8870 python/setup.py: remove unneeded wheel dependency
wheel is required since version 3.13.0 and
ff92cee10b

This will result in the following build failure when cross-compiling:

Download error on https://pypi.org/simple/wheel/: unknown url type: https -- Some packages may not be found!
Couldn't find index page for 'wheel' (maybe misspelled?)
Download error on https://pypi.org/simple/: unknown url type: https -- Some packages may not be found!
No local packages or working download links found for wheel

Remove wheel requirement from setup.py as it is only needed by
release.sh, not by setup.py

Fixes:
 - http://autobuild.buildroot.org/results/371c686a10d6870933011b46d36b1879d29046b9

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-09-21 12:25:14 -07:00
David L. Jones
ff06e23d23
Add a setuptools extension for generating Python protobufs (#7783)
This extension allows Python code to be generated from setup.py files, so they
are created as part of a normal Python build. The extension uses an already-existing
protoc binary, which can be explicitly specified if needed.
2020-08-31 10:40:57 -07:00
Misha Seltzer
223e89157a Removed test files from pypi distribution generation code.
Fixes #7493

By removing all test files from the distribution, we've reduced the .whl
file size from 1259808B (1.2MB) to 996042B (973K), which is 21% reduction,
And reduced the unpacked size from 5317178B (5.1MB) to 3251811B (3.2MB),
which is 39% reduction.

Size was measured for the protobuf-3.11.3-cp35-cp35m-manylinux1_x86_64.whl release.
2020-08-19 17:16:36 -07:00
Adam Cozzette
ff92cee10b Fixed release.sh and setup.py for Python
Newer versions of virtualenv lack the --no-site-packages option, so I
had to remove it to keep the release.sh script working. I read that this
option has already been the default for a long time, so removing it
shouldn't chany any behavior.

For the setup.py script, I was getting some errors about the bdist_wheel
argument to setup.py, but I was able to fix that by adding 'wheel' to
setup_requires.
2020-08-07 14:44:49 -07:00
Joshua Haberman
6ed738305b Sync from Piper @311396324
PROTOBUF_SYNC_PIPER
2020-05-13 13:46:15 -07:00
Joshua Haberman
b7742c51fd Sync from Piper @305505267
PROTOBUF_SYNC_PIPER
2020-04-08 10:30:17 -07:00
Joshua Haberman
b99994d994 Sync from Piper @304070343
PROTOBUF_SYNC_PIPER
2020-03-31 16:25:37 -07:00
David L. Jones
619a8262aa Make sure setup.py has a valid path.
In some invocation patterns, `os.path.dirname(__file__)` may not return a valid
value. This change defaults to os.curdir in that case.
2020-03-06 17:34:07 -08:00
Tim Swast
35a2bf9d90
python: publish sphinx docs to read the docs
Background:

This is a follow-up to the PR that adds sphinx docs.

Read the Docs is a hosting platform for documentation, primarily Python
docs. It supports builds at commit time as well as at specific git
labels to support versioned docs. I have claimed the
protobuf.readthedocs.io project and can add any Googlers who need access
to be able to configure and trigger builds.
https://readthedocs.org/projects/protobuf/builds/ It's also relatively
easy to create a new project to test the documentation builds from a
fork, such as https://readthedocs.org/projects/tswast-protobuf/builds/

About this change:

Once web hooks are configured, Read the Docs will automatically build
the docs for the latest changes on the master branch.

I needed to update `python/setup.py` to support installation from the
root of the repository because Read the Docs does not `cd python` before
installing the protobuf package with `setup.py install`. To support
this, I updated the file paths to use the absolute path to files. The
`__file__` special variable comes in handy for this, as it provides the
path to the `setup.py` file.

A banner is added to the docs when published to readthedocs. This links
to the official documentation and the future home of the stable API
reference on googleapis.dev.
2020-02-28 13:36:50 -06:00
Hao Nguyen
09cab821a9 Down integrate to GitHub 2019-06-11 16:00:16 -07:00
Yilun Chong
7bcb522287
fix mac python cpp building (#5786) 2019-02-26 15:47:09 -08:00
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
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
Feng Xiao
afe98de32a Replace repo links. 2018-08-22 11:55:30 -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
Arun Olappamanna Vasudevan
c7e0e262a6 pyext needs c++11 in linux and mac. (#4930) 2018-07-23 13:35:15 -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
Paul Yang
6f723a6624
Always add -std=c++11 for mac (#4684) 2018-05-25 14:42:41 -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
837c94b86f Include no_package.proto in Python test 2018-03-14 13:11:32 -07:00
Jisi Liu
acadade56e Remove py2.6 support. 2017-12-14 11:26:58 -08:00
Adam Cozzette
13fd045dbb Integrated internal changes from Google 2017-09-14 10:03:57 -07:00
Yilun Chong
18a0c2c4d2 add proto2 supported for cpp,python,nodejs,ruby,php 2017-06-27 18:24:15 -07:00
Sebastian Schuberth
902af0816e Prefer the term "3-Clause BSD License" over "New BSD License"
The first is the newer name, which is also more telling.
2017-02-28 09:58:24 +01:00
Paul Yang
7f3e237071 Merge 3.2.x branch into master (#2648)
* Down-integrate internal changes to github.

* Update conformance test failure list.

* Explicitly import used class in nano test to avoid random test fail.

* Update _GNUC_VER to use the correct implementation of atomic operation
on Mac.

* maps_test.js: check whether Symbol is defined before using it (#2524)

Symbol is not yet available on older versions of Node.js and so this
test fails with them. This change just directly checks whether Symbol is
available before we try to use it.

* Added well_known_types_embed.cc to CLEANFILES so that it gets cleaned up

* Updated Makefile.am to fix out-of-tree builds

* Added Bazel genrule for generating well_known_types_embed.cc

In pull request #2517 I made this change for the CMake and autotools
builds but forgot to do it for the Bazel build.

* Update _GNUC_VER to use the correct implementation of atomic operation on Mac.

* Add new js file in extra dist.

* Bump version number to 3.2.0

* Fixed issue with autoloading - Invalid paths (#2538)

* PHP fix int64 decoding (#2516)

* fix int64 decoding

* fix int64 decoding + tests

* Fix int64 decoding on 32-bit machines.

* Fix warning in compiler/js/embed.cc

embed.cc: In function ‘std::string CEscape(const string&)’:
embed.cc:51:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < str.size(); ++i) {
                                ^

* Fix include in auto-generated well_known_types_embed.cc

Restore include style fix (e3da722) that has been trampled by
auto-generation of well_known_types_embed.cc

* Fixed cross compilations with the Autotools build

Pull request #2517 caused cross compilations to start failing, because
the js_embed binary was being built to run on the target platform
instead of on the build machine. This change updates the Autotools build
to use the AX_PROG_CXX_FOR_BUILD macro to find a suitable compiler for
the build machine and always use that when building js_embed.

* Minor fix for autocreated object repeated fields and maps.

- If setting/clearing a repeated field/map that was objects, check the class
  before checking the autocreator.
- Just to be paranoid, don’t mutate within copy/mutableCopy for the autocreated
  classes to ensure there is less chance of issues if someone does something
  really crazy threading wise.
- Some more tests for the internal AutocreatedArray/AutocreatedDictionary
  classes to ensure things are working as expected.
- Add Xcode 8.2 to the full_mac_build.sh supported list.

* Fix generation of extending nested messages in JavaScript (#2439)

* Fix generation of extending nested messages in JavaScript

* Added missing test8.proto to build

* Fix generated code when there is no namespace but there is enum definition.

* Decoding unknown field should succeed.

* Add embed.cc in src/Makefile.am to fix dist check.

* Fixed "make distcheck" for the Autotools build

To make the test pass I needed to fix out-of-tree builds and update
EXTRA_DIST and CLEANFILES.

* Remove redundent embed.cc from src/Makefile.am

* Update version number to 3.2.0-rc.1 (#2578)

* Change protoc-artifacts version to 3.2.0-rc.1

* Update version number to 3.2.0rc2

* Update change logs for 3.2.0 release.

* Update php README

* Update upb, fixes some bugs (including a hash table problem). (#2611)

* Update upb, fixes some bugs (including a hash table problem).

* Ruby: added a test for the previous hash table corruption.

Verified that this triggers the bug in the currently released
version.

* Ruby: bugfix for SEGV.

* Ruby: removed old code for dup'ing defs.

* Reverting deployment target to 7.0 (#2618)

The Protobuf library doesn’t require the 7.1 deployment target so
reverting it back to 7.0

* Fix typo that breaks builds on big-endian (#2632)

* Bump version number to 3.2.0
2017-01-31 09:17:32 -08:00
Joshua Haberman
f1ce60e7b4 Factored Conformance and Benchmark test messages into shared test schema. (#1971)
* Factored Conformance test messages into shared test schema.

* Updated benchmarks to use new proto3 message locations.

* Fixed include path.

* Conformance: fixed include of Python test messages.

* Make maven in Rakefile use --batch-mode.

* Revert changes to benchmarks.

On second thought I think a separate schema for
CPU benchmarking makes sense.

* Try regenerating C# protos for new test protos.

* Removed benchmark messages from test proto.

* Added Jon Skeet's fixes for C#.

* Removed duplicate/old test messages C# file.

* C# fixes for test schema move.

* Fixed C# to use the correct TestAllTypes message.

* Fixes for Objective C test schema move.

* Added missing EXTRA_DIST file.
2016-12-03 11:51:25 -05:00
Adam Cozzette
d64a2d9941 Integrated internal changes from Google
This includes all internal changes from around May 20 to now.
2016-06-29 15:38:03 -07:00
Jisi Liu
b3bb46c51b Added download_url to be able to upload to pypi. 2016-05-17 10:50:43 -07:00
Jisi Liu
cba75ad404 Merge branch 'master' of github.com:google/protobuf 2016-04-01 16:46:49 -07:00
Manjunath Kudlur
cf828deb9b Linking the cpp implementation extension statically with libprotobuf 2016-04-01 15:58:48 -07:00
Jisi Liu
1bf446c71e Disable sign-compare warning. 2016-03-31 15:48:25 -07:00
Craig Citro
0e7c0c2fb8 Add back the namespace_packages arg in setup.py.
Improves #1296.

The problem: in the previous patch, we tweaked the __init__.py files to use
namespaces, but no longer declared ourselves as a namespace package. The
second half was unwise.

Note that this only comes up when installing protobuf alongside another
package that also installs into the google namespace; as of right now, the
only PyPI package that does is googleapis-common-protos, though the GAE SDK
also uses google.appengine. Installing either or both of those alongside this
package now works.

The case that still remains is the upgrade path, which is also what worried me
in #713. It seems that if protobuf 2.6.1 is installed, there's no way to
safely upgrade that to work with a newer protobuf. However, `pip uninstall` &&
`pip install` does the trick.
2016-03-05 00:10:11 -08:00
Silviu Calinoiu
786f80fe66 Add a modified patch from craigcitro@ to handle namespace sharing. 2016-02-18 16:12:11 -08:00
Josh Haberman
e891c29f9b Allow conformance test runner to tolerate crashes, and re-enable conformance tests. 2016-01-11 16:15:46 -08:00
Josh Haberman
e1abdf2c76 Fixed compile for Python 3. There are still some crashes though. 2015-12-30 16:09:53 -08:00
Feng Xiao
283c40c897 Require six>=1.9 for Python.
We use six sub-modules that aren't available in old versions. Not specifying
this requirement in the setup will lead to much less readable runtime errors.
It's particuarlly problematic for Mac OSX users because the system comes with
an old six version 1.4.1 by default.

[skip ci]
2015-12-29 14:36:46 -08:00
Feng Xiao
b7610f129d Add missing files to EXTRA_DIST.
Also delete some unused files.
2015-12-28 14:18:49 -08:00
Feng Xiao
e841bac4fc Down-integrate from internal code base. 2015-12-11 17:10:28 -08:00
Josh Haberman
4b31ffa488 Added Python failure lists, and fixes to make sure failure propagates. 2015-12-03 12:54:54 -08:00
Josh Haberman
325392dd61 Conformance test implementation for Python. 2015-12-02 12:53:42 -08:00