1
0
mirror of https://github.com/ansible/tower-cli.git synced 2026-02-05 15:48:09 +01:00
Files
tower-cli/version_swap.py
AlanCoding a44512a422 New awx-cli entry point and setup.py refactor
Switch from using scripts in setuptools to entry_point
Add a new entry_point "awx-cli" which functions the same
as tower-cli
Need for sudo has been eliminated for normal install method
2017-10-13 15:53:46 -04:00

30 lines
698 B
Python

import os
API_VERSION = 2
package_name = 'tower_cli_v%s' % API_VERSION
def convert_file(filename):
with open(filename) as f:
s = f.read()
if package_name in s:
raise Exception(
'While attempting to convert %s. '
'Command has already ran, no need to run again.' % filename
)
s = s.replace('tower_cli', package_name)
with open(filename, "w") as f:
f.write(s)
# Conversion of secondary source tree
for dname, dirs, files in os.walk(package_name):
for fname in files:
fpath = os.path.join(dname, fname)
convert_file(fpath)
# Conversion of seconary setup file
convert_file('setup_v%s.py' % API_VERSION)