Remove f-strings to remove requirement on py36
This is a small change that removes the hard requirement for python>=3.6. We can reconsider it in the future but for now this makes it easier for certain users to deploy for their environment. This also fixes wrong indentation on the settings file comment. Change-Id: Iab84818e5e50aa1e3a0951be154718be04fb53f5
This commit is contained in:
parent
802342c01d
commit
d82857d4cb
@ -17,7 +17,7 @@ A stateless javascript client interface is provided by a different project,
|
||||
Quickstart
|
||||
==========
|
||||
|
||||
Here's how you can get started from scratch with sane defaults with python>=3.6:
|
||||
Here's how you can get started from scratch with sane defaults with python>=3.5:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
@ -42,7 +42,7 @@ def get_client(
|
||||
|
||||
return AraHttpClient(endpoint=endpoint, timeout=timeout, auth=auth)
|
||||
else:
|
||||
raise ValueError(f"Unsupported API client: {client} (use 'http' or 'offline')")
|
||||
raise ValueError("Unsupported API client: %s (use 'http' or 'offline')" % client)
|
||||
|
||||
|
||||
def active_client():
|
||||
|
@ -33,7 +33,7 @@ def main():
|
||||
raise MissingDjangoException from e
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
print(f"[ara] Using settings file: {settings.ARA_SETTINGS}")
|
||||
print("[ara] Using settings file: %s" % settings.ARA_SETTINGS)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -238,7 +238,7 @@ ARA_SETTINGS = os.getenv("ARA_SETTINGS", DEFAULT_SETTINGS)
|
||||
|
||||
# Ensure default base configuration/data directory exists
|
||||
if not os.path.isdir(BASE_DIR):
|
||||
print(f"[ara] Creating data & configuration directory: {BASE_DIR}")
|
||||
print("[ara] Creating data & configuration directory: %s" % BASE_DIR)
|
||||
os.makedirs(BASE_DIR, mode=0o700)
|
||||
|
||||
if not os.path.exists(DEFAULT_SETTINGS) and "ARA_SETTINGS" not in os.environ:
|
||||
@ -268,13 +268,18 @@ if not os.path.exists(DEFAULT_SETTINGS) and "ARA_SETTINGS" not in os.environ:
|
||||
TIME_ZONE=TIME_ZONE,
|
||||
)
|
||||
with open(DEFAULT_SETTINGS, "w+") as settings_file:
|
||||
comment = f"""---
|
||||
# This is a default settings template generated by ARA.
|
||||
# To use a settings file such as this one, you need to export the
|
||||
# ARA_SETTINGS environment variable like so:
|
||||
# $ export ARA_SETTINGS="{DEFAULT_SETTINGS}"
|
||||
comment = textwrap.dedent(
|
||||
"""
|
||||
---
|
||||
# This is a default settings template generated by ARA.
|
||||
# To use a settings file such as this one, you need to export the
|
||||
# ARA_SETTINGS environment variable like so:
|
||||
# $ export ARA_SETTINGS="{}"
|
||||
|
||||
"""
|
||||
print(f"[ara] Writing default settings to {DEFAULT_SETTINGS}")
|
||||
settings_file.write(textwrap.dedent(comment))
|
||||
""".format(
|
||||
DEFAULT_SETTINGS
|
||||
)
|
||||
)
|
||||
print("[ara] Writing default settings to %s" % DEFAULT_SETTINGS)
|
||||
settings_file.write(comment.lstrip())
|
||||
yaml.dump({"default": SETTINGS}, settings_file, default_flow_style=False)
|
||||
|
@ -18,7 +18,7 @@ the project's `README <https://github.com/ansible-community/ara-web>`_.
|
||||
Requirements and dependencies
|
||||
-----------------------------
|
||||
|
||||
ARA should work on any Linux distribution as long as python3.6 and greater is
|
||||
ARA should work on any Linux distribution as long as python3.5 and greater is
|
||||
available.
|
||||
|
||||
In order to record data, ARA provides Ansible plugins that must be installed
|
||||
|
@ -18,16 +18,16 @@
|
||||
|
||||
# The ansible_python_version fact might end up retrieving the version of
|
||||
# python2 so we need to explicitely get the version of python 3 available.
|
||||
- name: Validate availability of Python 3.6
|
||||
- name: Validate availability of Python 3.5
|
||||
command: /usr/bin/python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: python_version
|
||||
|
||||
- name: Fail pre-emptively if running Python <3.6
|
||||
- name: Fail pre-emptively if running Python <3.5
|
||||
fail:
|
||||
msg: "Python >=3.6 is required to run ARA"
|
||||
when: python_version.stdout is version('3.6', '<') or python_version.rc != 0
|
||||
msg: "Python >=3.5 is required to run ARA"
|
||||
when: python_version.stdout is version('3.5', '<') or python_version.rc != 0
|
||||
|
||||
- name: Get list of installed packages
|
||||
package_facts:
|
||||
|
@ -16,7 +16,9 @@ classifier =
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.5
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
Development Status :: 4 - Beta
|
||||
|
||||
[global]
|
||||
|
Loading…
x
Reference in New Issue
Block a user