Repository: beam Updated Branches: refs/heads/master b75888e32 -> 444edae75
[BEAM-547] [BEAM-1730] Cleanup versions.py Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/f11a44c6 Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/f11a44c6 Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/f11a44c6 Branch: refs/heads/master Commit: f11a44c62b5b4701d11886eaee5cbe0e2dad88dd Parents: b75888e Author: Sourabh Bajaj <[email protected]> Authored: Wed Mar 15 16:14:44 2017 -0700 Committer: Ahmet Altay <[email protected]> Committed: Thu Mar 16 11:39:46 2017 -0700 ---------------------------------------------------------------------- sdks/python/MANIFEST.in | 3 --- sdks/python/apache_beam/__init__.py | 3 +++ sdks/python/apache_beam/version.py | 36 -------------------------------- 3 files changed, 3 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/f11a44c6/sdks/python/MANIFEST.in ---------------------------------------------------------------------- diff --git a/sdks/python/MANIFEST.in b/sdks/python/MANIFEST.in index 57f684e..ff572ba 100644 --- a/sdks/python/MANIFEST.in +++ b/sdks/python/MANIFEST.in @@ -15,7 +15,4 @@ # limitations under the License. # -# This file is used from Python to sync versions -include pom.xml - include README.md http://git-wip-us.apache.org/repos/asf/beam/blob/f11a44c6/sdks/python/apache_beam/__init__.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/__init__.py b/sdks/python/apache_beam/__init__.py index 77c89ad..5a63fff 100644 --- a/sdks/python/apache_beam/__init__.py +++ b/sdks/python/apache_beam/__init__.py @@ -77,6 +77,9 @@ import apache_beam.internal.pickler from apache_beam import coders from apache_beam import io from apache_beam import typehints +from apache_beam import version from apache_beam.pipeline import Pipeline from apache_beam.transforms import * # pylint: enable=wrong-import-position + +__version__ = version.__version__ http://git-wip-us.apache.org/repos/asf/beam/blob/f11a44c6/sdks/python/apache_beam/version.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/version.py b/sdks/python/apache_beam/version.py index e5d61a1..22d1683 100644 --- a/sdks/python/apache_beam/version.py +++ b/sdks/python/apache_beam/version.py @@ -18,40 +18,4 @@ """Apache Beam SDK version information and utilities.""" -import re - - __version__ = '0.7.0.dev' - - -# The following utilities are legacy code from the Maven integration; -# see BEAM-378 for further details. - - -# Reads the actual version from pom.xml file, -def get_version_from_pom(): - with open('pom.xml', 'r') as f: - pom = f.read() - regex = (r'.*<parent>\s*' - r'<groupId>[a-z\.]+</groupId>\s*' - r'<artifactId>[a-z\-]+</artifactId>\s*' - r'<version>([0-9a-zA-Z\.\-]+)</version>.*') - pattern = re.compile(str(regex)) - search = pattern.search(pom) - version = search.group(1) - version = version.replace("-SNAPSHOT", ".dev") - return version - - -# Synchronizes apache_beam.__version__ field for later usage -def sync_version(version): - init_path = 'apache_beam/__init__.py' - regex = r'^__version__\s*=\s*".*"' - with open(init_path, "r") as f: - lines = f.readlines() - with open(init_path, "w") as f: - for line in lines: - if re.search(regex, line): - f.write(re.sub(regex, '__version__ = "%s"' % version, line)) - else: - f.write(line)
