davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=9dce9ccad430a2b840b0d0a20ca1b137932543dc

commit 9dce9ccad430a2b840b0d0a20ca1b137932543dc
Author: Dave Andreoli <[email protected]>
Date:   Sun Dec 5 12:24:38 2021 +0100

    setup: stop importing the version from sources
    
    This was creating all sort of issues, because the efl modules in sources
    are not meant to work. And installation from sdist using pip was
    complainig about efl not found (because it build in a restricted env)
    
    So just read the __init__.py file and extract the version from there
    (to be DRY)
---
 efl/__init__.py |  8 ++++----
 setup.py        | 15 ++++++++++-----
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/efl/__init__.py b/efl/__init__.py
index 3ef3d70..0d444d0 100644
--- a/efl/__init__.py
+++ b/efl/__init__.py
@@ -16,11 +16,11 @@
 # along with this Python-EFL.  If not, see <http://www.gnu.org/licenses/>.
 
 # semver examples:
-# development: "1.12.99" ( 1, 12, 99 )
-# pre-release: "1.13.0-beta1" ( 1, 13, 0 )
-# release:     "1.13.0" ( 1, 13, 0 )
+# development: '1.12.99' ( 1, 12, 99 )
+# pre-release: '1.13.0-beta1' ( 1, 13, 0 )
+# release:     '1.13.0' ( 1, 13, 0 )
 
-__version__ = "1.25.99"
+__version__ = '1.25.99'
 __version_info__ = (1, 25, 99)
 
 
diff --git a/setup.py b/setup.py
index da66765..11b9968 100755
--- a/setup.py
+++ b/setup.py
@@ -8,14 +8,10 @@ import subprocess
 import unittest
 from distutils.version import LooseVersion
 from setuptools import setup, Extension, Command
-from efl import __version__, __version_info__ as vers
 
 script_path = os.path.dirname(os.path.abspath(__file__))
 
 
-# python-efl version (change in efl/__init__.py)
-RELEASE = __version__
-
 # dependencies
 EFL_MIN_VER = '1.25.99'
 CYTHON_MIN_VERSION = '0.23.5'
@@ -38,9 +34,18 @@ def cmd_output(cmd):
         return ''
     return p.stdout.read().decode('utf-8').strip()
 
+def get_version(rel_path):
+    for line in read_file(rel_path).splitlines():
+        if line.startswith('__version__'):
+            return line.split("'")[1]
+    raise SystemExit('Unable to find version string.')
+
+
+# python-efl version from sources
+RELEASE = get_version('efl/__init__.py')
 
 # add git commit count for dev builds
-if vers[2] == 99:
+if RELEASE.split('.')[2] == '99':
     count = cmd_output('git rev-list --count HEAD') or '0'
     RELEASE += 'a' + count
 sys.stdout.write('Python-EFL: %s\n' % RELEASE)

-- 


Reply via email to