mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 03:25:42 +00:00
switched to single quotes everywhere
This commit is contained in:
@ -11,7 +11,7 @@ import requests
|
||||
|
||||
def fetch_rtd_versions():
|
||||
"""Get a list of RTD docs versions to build the version selector"""
|
||||
print("Fetching documentation versions from ReadTheDocs")
|
||||
print('Fetching documentation versions from ReadTheDocs')
|
||||
|
||||
versions = []
|
||||
|
||||
@ -20,7 +20,7 @@ def fetch_rtd_versions():
|
||||
response = requests.get(url, headers=headers)
|
||||
|
||||
if response.status_code != 200:
|
||||
print(f"Error fetching RTD versions: {response.status_code}")
|
||||
print(f'Error fetching RTD versions: {response.status_code}')
|
||||
return
|
||||
|
||||
data = json.loads(response.text)
|
||||
@ -48,10 +48,10 @@ def fetch_rtd_versions():
|
||||
token = os.environ.get('RTD_TOKEN', None)
|
||||
if token:
|
||||
headers = {'Authorization': f'Token {token}'}
|
||||
url = "https://readthedocs.org/api/v3/projects/inventree/versions/?active=true&limit=50"
|
||||
url = 'https://readthedocs.org/api/v3/projects/inventree/versions/?active=true&limit=50'
|
||||
make_request(url, headers)
|
||||
else:
|
||||
print("No RTD token found - skipping RTD version fetch")
|
||||
print('No RTD token found - skipping RTD version fetch')
|
||||
|
||||
# Sort versions by version number
|
||||
versions = sorted(versions, key=lambda x: StrictVersion(x['version']), reverse=True)
|
||||
@ -79,7 +79,7 @@ def fetch_rtd_versions():
|
||||
|
||||
output_filename = os.path.join(os.path.dirname(__file__), 'versions.json')
|
||||
|
||||
print("Discovered the following versions:")
|
||||
print('Discovered the following versions:')
|
||||
print(versions)
|
||||
|
||||
with open(output_filename, 'w') as file:
|
||||
@ -104,14 +104,14 @@ def get_release_data():
|
||||
return json.loads(f.read())
|
||||
|
||||
# Download release information via the GitHub API
|
||||
print("Fetching InvenTree release information from api.github.com:")
|
||||
print('Fetching InvenTree release information from api.github.com:')
|
||||
releases = []
|
||||
|
||||
# Keep making API requests until we run out of results
|
||||
page = 1
|
||||
|
||||
while 1:
|
||||
url = f"https://api.github.com/repos/inventree/inventree/releases?page={page}&per_page=150"
|
||||
url = f'https://api.github.com/repos/inventree/inventree/releases?page={page}&per_page=150'
|
||||
|
||||
response = requests.get(url, timeout=30)
|
||||
assert response.status_code == 200
|
||||
@ -163,12 +163,12 @@ def on_config(config, *args, **kwargs):
|
||||
rtd_version = os.environ['READTHEDOCS_VERSION']
|
||||
rtd_language = os.environ['READTHEDOCS_LANGUAGE']
|
||||
|
||||
site_url = f"https://docs.inventree.org/{rtd_language}/{rtd_version}"
|
||||
assets_dir = f"/{rtd_language}/{rtd_version}/assets"
|
||||
site_url = f'https://docs.inventree.org/{rtd_language}/{rtd_version}'
|
||||
assets_dir = f'/{rtd_language}/{rtd_version}/assets'
|
||||
|
||||
print("Building within READTHEDOCS environment!")
|
||||
print(f" - Version: {rtd_version}")
|
||||
print(f" - Language: {rtd_language}")
|
||||
print('Building within READTHEDOCS environment!')
|
||||
print(f' - Version: {rtd_version}')
|
||||
print(f' - Language: {rtd_language}')
|
||||
|
||||
# Add *all* readthedocs related keys
|
||||
readthedocs = {}
|
||||
@ -187,7 +187,7 @@ def on_config(config, *args, **kwargs):
|
||||
|
||||
else:
|
||||
print("'READTHEDOCS' environment variable not found")
|
||||
print("Building for localhost configuration!")
|
||||
print('Building for localhost configuration!')
|
||||
|
||||
assets_dir = '/assets'
|
||||
site_url = config['site_url']
|
||||
@ -215,7 +215,7 @@ def on_config(config, *args, **kwargs):
|
||||
re.match(r'^\d+\.\d+\.\d+$', tag)
|
||||
|
||||
if not re.match:
|
||||
print(f"Found badly formatted release: {tag}")
|
||||
print(f'Found badly formatted release: {tag}')
|
||||
continue
|
||||
|
||||
# Check if there is a local file with release information
|
||||
@ -238,7 +238,7 @@ def on_config(config, *args, **kwargs):
|
||||
|
||||
releases.append(item)
|
||||
|
||||
print(f"- found {len(releases)} releases.")
|
||||
print(f'- found {len(releases)} releases.')
|
||||
|
||||
# Sort releases by descending date
|
||||
config['releases'] = sorted(releases, key=lambda it: it['date'], reverse=True)
|
||||
|
Reference in New Issue
Block a user