avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fo...@apache.org
Subject [avro] branch master updated: AVRO-2424: Make Py2 bindings work on setuptools' development mode (#546)
Date Thu, 04 Jul 2019 09:23:23 GMT
This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new 4317e4a  AVRO-2424: Make Py2 bindings work on setuptools' development mode (#546)
4317e4a is described below

commit 4317e4a2610555fe205e892ba0494f8bc6dcb2b4
Author: Kengo Seki <sekikn@apache.org>
AuthorDate: Thu Jul 4 18:23:19 2019 +0900

    AVRO-2424: Make Py2 bindings work on setuptools' development mode (#546)
    
    * AVRO-2424: Make Py2 bindings work on setuptools' development mode
    
    * AVRO-2424: Make Py2 bindings work on setuptools' development mode
    
    Wrap the logic to get version information into a function.
    
    * AVRO-2424: Make Py2 bindings work on setuptools' development mode
    
    Consolidate the exclusion of *.egg-info for rat and .gitignore.
---
 .gitignore          |  1 +
 lang/py/setup.py    | 16 +++++++++++++---
 lang/py3/.gitignore |  1 -
 pom.xml             |  2 +-
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index edb7931..5cbf6d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
 .classpath
 target
 *.pyc
+*.egg-info
 .svn
 /build
 test-output
diff --git a/lang/py/setup.py b/lang/py/setup.py
index 6902116..bf48dfc 100755
--- a/lang/py/setup.py
+++ b/lang/py/setup.py
@@ -15,15 +15,25 @@
 # 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.
-
+import os
 import setuptools
 
 
+def _get_version():
+  curdir = os.getcwd()
+  version_file = ("VERSION.txt" if os.path.isfile("VERSION.txt")
+    else os.path.join(curdir[:curdir.index("lang/py")], "share/VERSION.txt"))
+  with open(version_file) as verfile:
+    # To follow the naming convention defined by PEP 440
+    # in the case that the version is like "x.y.z-SNAPSHOT"
+    return verfile.read().rstrip().replace("-", "+")
+
+
 setuptools.setup(
   name = 'avro',
-  version = '@AVRO_VERSION@',
+  version = _get_version(),
   packages = ['avro'],
-  package_dir = {'avro': 'src/avro'},
+  package_dir = {'': 'src'},
   scripts = ["./scripts/avro"],
 
   #include_package_data=True,
diff --git a/lang/py3/.gitignore b/lang/py3/.gitignore
index 777f026..5301048 100644
--- a/lang/py3/.gitignore
+++ b/lang/py3/.gitignore
@@ -2,5 +2,4 @@ avro/HandshakeRequest.avsc
 avro/HandshakeResponse.avsc
 avro/VERSION.txt
 avro/tests/interop.avsc
-avro_python3.egg-info/
 dist/
diff --git a/pom.xml b/pom.xml
index ee8afbe..f3215cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -290,6 +290,7 @@
                 <!-- build or test files (some are generated files that we commit as-is
for testing purposes) -->
                 <exclude>**/*.log</exclude>
                 <exclude>**/*.rej</exclude>
+                <exclude>**/*.egg-info/**</exclude>
                 <exclude>build/**</exclude>
                 <exclude>doc/build/**</exclude>
                 <exclude>lang/java/archetypes/**</exclude>
@@ -301,7 +302,6 @@
                 <exclude>lang/perl/pm_to_blib</exclude>
                 <exclude>lang/perl/blib/**/.exists</exclude>
                 <exclude>lang/py/build/**</exclude>
-                <exclude>lang/py3/avro_python3.egg-info/**</exclude>
                 <exclude>lang/ruby/Gemfile.lock</exclude>
                 <exclude>lang/ruby/avro.gemspec</exclude>
                 <exclude>lang/ruby/.gem/**</exclude>


Mime
View raw message