Skip to content

Commit a45a5d3

Browse files
authored
Merge pull request #5 from cloudify-incubator/RND-215-use-version-file-in-all-repos
add __version__.py
2 parents 6dd6ad5 + 9349936 commit a45a5d3

File tree

6 files changed

+13
-18
lines changed

6 files changed

+13
-18
lines changed

CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
0.0.1: POC
22
0.1.0: Productized release.
3+
0.1.1: add __version__.py file

plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins:
33
sl:
44
executor: central_deployment_agent
55
package_name: cloudify-serverless-plugin
6-
package_version: '0.1.0'
6+
package_version: '0.1.1'
77

88
data_types:
99

plugin_1_4.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins:
33
sl:
44
executor: central_deployment_agent
55
package_name: cloudify-serverless-plugin
6-
package_version: '0.1.0'
6+
package_version: '0.1.1'
77

88
data_types:
99

serverless_plugin/__version__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version = '0.1.1'

setup.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,20 @@
1515

1616

1717
import os
18+
import re
19+
import pathlib
1820
from setuptools import (
1921
setup,
2022
find_packages
2123
)
2224

2325

24-
def read(rel_path):
25-
here = os.path.abspath(os.path.dirname(__file__))
26-
with open(os.path.join(here, rel_path), 'r') as fp:
27-
return fp.read()
28-
29-
30-
def get_version(rel_file='plugin.yaml'):
31-
lines = read(rel_file)
32-
for line in lines.splitlines():
33-
if 'package_version' in line:
34-
split_line = line.split(':')
35-
line_no_space = split_line[-1].replace(' ', '')
36-
line_no_quotes = line_no_space.replace('\'', '')
37-
return line_no_quotes.strip('\n')
38-
raise RuntimeError('Unable to find version string.')
26+
def get_version():
27+
current_dir = pathlib.Path(__file__).parent.resolve()
28+
with open(os.path.join(current_dir, 'serverless_plugin/__version__.py'),
29+
'r') as outfile:
30+
var = outfile.read()
31+
return re.search(r'\d+.\d+.\d+', var).group()
3932

4033

4134
setup(

v2_plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins:
33
sl:
44
executor: central_deployment_agent
55
package_name: cloudify-serverless-plugin
6-
package_version: '0.1.0'
6+
package_version: '0.1.1'
77

88
data_types:
99

0 commit comments

Comments
 (0)