Skip to content

Commit df50ccd

Browse files
committed
Refactored the package version information so that the source of truth for the package version is in one location, the package __init__. The setup script points to the __version__ in the package init so you don't have to update it in many places
1 parent 8eba87e commit df50ccd

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

meraki/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
MAXIMUM_RETRIES, OUTPUT_LOG, LOG_PATH, LOG_FILE_PREFIX, PRINT_TO_CONSOLE, SIMULATE_API_CALLS
8585
)
8686

87+
__version__ = '0.80.3'
88+
8789

8890
class DashboardAPI(object):
8991
"""

setup.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@
88
with open(os.path.join(HERE, 'README.md')) as fid:
99
README = fid.read()
1010

11+
12+
def find_version(fname):
13+
'''Attempts to find the version number in the file names fname.
14+
Raises RuntimeError if not found.
15+
'''
16+
version = ''
17+
with open(fname, 'r') as fp:
18+
reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
19+
for line in fp:
20+
m = reg.match(line)
21+
if m:
22+
version = m.group(1)
23+
break
24+
if not version:
25+
raise RuntimeError('Cannot find version information')
26+
return version
27+
28+
1129
setup(
1230
name='meraki',
1331
version='0.70.5',

0 commit comments

Comments
 (0)