arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-379: Use setuptools_scm for Python versioning
Date Sun, 04 Dec 2016 15:50:52 GMT
Repository: arrow
Updated Branches:
  refs/heads/master b5de9e56d -> 0ac01a5bf


ARROW-379: Use setuptools_scm for Python versioning

Author: Uwe L. Korn <uwelk@xhochy.com>

Closes #224 from xhochy/ARROW-379 and squashes the following commits:

3a68d9f [Uwe L. Korn] Remove deprecated version import
15fe9b2 [Uwe L. Korn] Add license header
aa9bd49 [Uwe L. Korn] ARROW-379: Use setuptools_scm for Python versioning


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/0ac01a5b
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/0ac01a5b
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/0ac01a5b

Branch: refs/heads/master
Commit: 0ac01a5bf6747a5855d20632c9c7874483b9830a
Parents: b5de9e5
Author: Uwe L. Korn <uwelk@xhochy.com>
Authored: Sun Dec 4 10:50:43 2016 -0500
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Sun Dec 4 10:50:43 2016 -0500

----------------------------------------------------------------------
 dev/release/00-prepare.sh  |  5 -----
 python/.git_archival.txt   |  1 +
 python/.gitattributes      |  1 +
 python/pyarrow/__init__.py | 10 ++++++++--
 python/setup.cfg           | 20 ++++++++++++++++++++
 python/setup.py            | 23 ++---------------------
 6 files changed, 32 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/0ac01a5b/dev/release/00-prepare.sh
----------------------------------------------------------------------
diff --git a/dev/release/00-prepare.sh b/dev/release/00-prepare.sh
index 3423a3e..00af5e7 100644
--- a/dev/release/00-prepare.sh
+++ b/dev/release/00-prepare.sh
@@ -43,9 +43,4 @@ mvn release:prepare -Dtag=${tag} -DreleaseVersion=${version} -DautoVersionSubmod
 
 cd -
 
-cd "${SOURCE_DIR}/../../python"
-sed -i "s/VERSION = '[^']*'/VERSION = '${version}'/g" setup.py
-sed -i "s/ISRELEASED = False/ISRELEASED = True/g" setup.py
-cd -
-
 echo "Finish staging binary artifacts by running: sh dev/release/01-perform.sh"

http://git-wip-us.apache.org/repos/asf/arrow/blob/0ac01a5b/python/.git_archival.txt
----------------------------------------------------------------------
diff --git a/python/.git_archival.txt b/python/.git_archival.txt
new file mode 100644
index 0000000..95cb3ee
--- /dev/null
+++ b/python/.git_archival.txt
@@ -0,0 +1 @@
+ref-names: $Format:%D$

http://git-wip-us.apache.org/repos/asf/arrow/blob/0ac01a5b/python/.gitattributes
----------------------------------------------------------------------
diff --git a/python/.gitattributes b/python/.gitattributes
new file mode 100644
index 0000000..00a7b00
--- /dev/null
+++ b/python/.gitattributes
@@ -0,0 +1 @@
+.git_archival.txt  export-subst

http://git-wip-us.apache.org/repos/asf/arrow/blob/0ac01a5b/python/pyarrow/__init__.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py
index d4d0f00..f366317 100644
--- a/python/pyarrow/__init__.py
+++ b/python/pyarrow/__init__.py
@@ -17,6 +17,14 @@
 
 # flake8: noqa
 
+from pkg_resources import get_distribution, DistributionNotFound
+try:
+    __version__ = get_distribution(__name__).version
+except DistributionNotFound:
+   # package is not installed
+   pass
+
+
 import pyarrow.config
 
 from pyarrow.array import (Array,
@@ -43,5 +51,3 @@ from pyarrow.schema import (null, bool_,
 
 from pyarrow.table import (Column, RecordBatch, dataframe_from_batches, Table,
                            from_pandas_dataframe)
-
-from pyarrow.version import version as __version__

http://git-wip-us.apache.org/repos/asf/arrow/blob/0ac01a5b/python/setup.cfg
----------------------------------------------------------------------
diff --git a/python/setup.cfg b/python/setup.cfg
new file mode 100644
index 0000000..caae3e0
--- /dev/null
+++ b/python/setup.cfg
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[build_sphinx]
+source-dir = doc/
+build-dir  = doc/_build

http://git-wip-us.apache.org/repos/asf/arrow/blob/0ac01a5b/python/setup.py
----------------------------------------------------------------------
diff --git a/python/setup.py b/python/setup.py
index 341cc64..0f6bbda 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -42,27 +42,9 @@ is_64_bit = sys.maxsize > 2**32
 if Cython.__version__ < '0.19.1':
     raise Exception('Please upgrade to Cython 0.19.1 or newer')
 
-VERSION = '0.1.0'
-ISRELEASED = False
-
-if not ISRELEASED:
-    VERSION += '.dev'
-
 setup_dir = os.path.abspath(os.path.dirname(__file__))
 
 
-def write_version_py(filename=os.path.join(setup_dir, 'pyarrow/version.py')):
-    a = open(filename, 'w')
-    file_content = "\n".join(["",
-                              "# THIS FILE IS GENERATED FROM SETUP.PY",
-                              "version = '%(version)s'",
-                              "isrelease = '%(isrelease)s'"])
-
-    a.write(file_content % {'version': VERSION,
-                            'isrelease': str(ISRELEASED)})
-    a.close()
-
-
 class clean(_clean):
 
     def run(self):
@@ -261,15 +243,12 @@ class build_ext(_build_ext):
         return [self._get_cmake_ext_path(name)
                 for name in self.get_names()]
 
-write_version_py()
-
 DESC = """\
 Python library for Apache Arrow"""
 
 setup(
     name="pyarrow",
     packages=['pyarrow', 'pyarrow.tests'],
-    version=VERSION,
     zip_safe=False,
     package_data={'pyarrow': ['*.pxd', '*.pyx']},
     # Dummy extension to trigger build_ext
@@ -279,6 +258,8 @@ setup(
         'clean': clean,
         'build_ext': build_ext
     },
+    use_scm_version = {"root": "..", "relative_to": __file__},
+    setup_requires=['setuptools_scm', 'setuptools_scm_git_archive'],
     install_requires=['cython >= 0.23', 'numpy >= 1.9', 'six >= 1.0.0'],
     description=DESC,
     license='Apache License, Version 2.0',


Mime
View raw message