Skip to content

Commit f885628

Browse files
authored
move read version (#294)
1 parent 79c541f commit f885628

File tree

4 files changed

+20
-32
lines changed

4 files changed

+20
-32
lines changed

appium/common/helper.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import io
16+
import os
17+
1518

1619
def appium_bytes(value, encoding):
1720
"""
@@ -31,3 +34,16 @@ def appium_bytes(value, encoding):
3134
return bytes(value, encoding) # Python 3
3235
except TypeError:
3336
return value # Python 2
37+
38+
39+
def library_version():
40+
"""
41+
Return a version of this python library
42+
"""
43+
44+
global_param = {}
45+
exec(
46+
io.open(os.path.join(os.path.dirname('__file__'), 'appium', 'version.py'), encoding='utf-8').read(),
47+
global_param
48+
)
49+
return global_param['version']

script/helper.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

script/release.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import os
1717
import sys
18-
from helper import read_version
18+
from appium.common.helper import library_version
1919

2020
VERSION_FILE_PATH = os.path.join(os.path.dirname('__file__'), 'appium', 'version.py')
2121
CHANGELOG_PATH = os.path.join(os.path.dirname('__file__'), 'CHANGELOG.rst')
@@ -26,7 +26,7 @@
2626

2727

2828
def get_current_version():
29-
current = read_version()
29+
current = library_version()
3030
print('The current version is {}, type a new one'.format(MESSAGE_YELLOW.format(current)))
3131
return current
3232

setup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616

1717
from distutils.core import setup
1818
from setuptools import setup
19-
20-
from script.helper import read_version
21-
19+
from appium.common.helper import library_version
2220

2321
setup(
2422
name='Appium-Python-Client',
25-
version=read_version(),
23+
version=library_version(),
2624
description='Python client for Appium',
2725
long_description=io.open(os.path.join(os.path.dirname('__file__'), 'README.md'), encoding='utf-8').read(),
2826
keywords=[

0 commit comments

Comments
 (0)