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:
@ -5,15 +5,15 @@ import json
|
||||
import requests
|
||||
|
||||
# We expect the server to be running on the local host
|
||||
url = "http://localhost:8000/api/"
|
||||
url = 'http://localhost:8000/api/'
|
||||
|
||||
print("Testing InvenTree API endpoint")
|
||||
print('Testing InvenTree API endpoint')
|
||||
|
||||
response = requests.get(url)
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
print("- Response 200 OK")
|
||||
print('- Response 200 OK')
|
||||
|
||||
data = json.loads(response.text)
|
||||
|
||||
@ -26,6 +26,6 @@ for key in required_keys:
|
||||
# Check that the worker is running
|
||||
assert data['worker_running']
|
||||
|
||||
print("- Background worker is operational")
|
||||
print('- Background worker is operational')
|
||||
|
||||
print("API Endpoint Tests Passed OK")
|
||||
print('API Endpoint Tests Passed OK')
|
||||
|
@ -18,14 +18,14 @@ js_dynamic_dir = os.path.join(template_dir, 'js', 'dynamic')
|
||||
|
||||
errors = 0
|
||||
|
||||
print("=================================")
|
||||
print("Checking static javascript files:")
|
||||
print("=================================")
|
||||
print('=================================')
|
||||
print('Checking static javascript files:')
|
||||
print('=================================')
|
||||
|
||||
|
||||
def check_invalid_tag(data):
|
||||
"""Check for invalid tags."""
|
||||
pattern = r"{%(\w+)"
|
||||
pattern = r'{%(\w+)'
|
||||
|
||||
err_count = 0
|
||||
|
||||
@ -35,7 +35,7 @@ def check_invalid_tag(data):
|
||||
for result in results:
|
||||
err_count += 1
|
||||
|
||||
print(f" - Error on line {idx+1}: %{{{result[0]}")
|
||||
print(f' - Error on line {idx+1}: %{{{result[0]}')
|
||||
|
||||
return err_count
|
||||
|
||||
@ -55,7 +55,7 @@ def check_prohibited_tags(data):
|
||||
'url',
|
||||
]
|
||||
|
||||
pattern = r"{% (\w+)\s"
|
||||
pattern = r'{% (\w+)\s'
|
||||
|
||||
err_count = 0
|
||||
|
||||
@ -94,9 +94,9 @@ for filename in pathlib.Path(js_dynamic_dir).rglob('*.js'):
|
||||
if len(results) > 0:
|
||||
errors += 1
|
||||
|
||||
print(f" > prohibited {{% trans %}} tag found at line {idx + 1}")
|
||||
print(f' > prohibited {{% trans %}} tag found at line {idx + 1}')
|
||||
|
||||
if errors > 0:
|
||||
print(f"Found {errors} incorrect template tags")
|
||||
print(f'Found {errors} incorrect template tags')
|
||||
|
||||
sys.exit(errors)
|
||||
|
@ -3,7 +3,7 @@
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
print("Checking for uncommitted locale files...")
|
||||
print('Checking for uncommitted locale files...')
|
||||
|
||||
cmd = ['git', 'status']
|
||||
|
||||
@ -19,9 +19,9 @@ for line in str(out.decode()).split('\n'):
|
||||
locales.append(line)
|
||||
|
||||
if len(locales) > 0:
|
||||
print("There are {n} unstaged locale files:".format(n=len(locales)))
|
||||
print('There are {n} unstaged locale files:'.format(n=len(locales)))
|
||||
|
||||
for lang in locales:
|
||||
print(" - {l}".format(l=lang))
|
||||
print(' - {l}'.format(l=lang))
|
||||
|
||||
sys.exit(len(locales))
|
||||
|
@ -3,7 +3,7 @@
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
print("Checking for unstaged migration files...")
|
||||
print('Checking for unstaged migration files...')
|
||||
|
||||
cmd = ['git', 'ls-files', '--exclude-standard', '--others']
|
||||
|
||||
@ -20,9 +20,9 @@ for line in str(out.decode()).split('\n'):
|
||||
if len(migrations) == 0:
|
||||
sys.exit(0)
|
||||
|
||||
print("There are {n} unstaged migration files:".format(n=len(migrations)))
|
||||
print('There are {n} unstaged migration files:'.format(n=len(migrations)))
|
||||
|
||||
for m in migrations:
|
||||
print(" - {m}".format(m=m))
|
||||
print(' - {m}'.format(m=m))
|
||||
|
||||
sys.exit(len(migrations))
|
||||
|
@ -26,7 +26,7 @@ def get_existing_release_tags():
|
||||
headers = None
|
||||
|
||||
if token:
|
||||
headers = {"Authorization": f"Bearer {token}"}
|
||||
headers = {'Authorization': f'Bearer {token}'}
|
||||
|
||||
response = requests.get(
|
||||
'https://api.github.com/repos/inventree/inventree/releases', headers=headers
|
||||
@ -44,7 +44,7 @@ def get_existing_release_tags():
|
||||
|
||||
for release in data:
|
||||
tag = release['tag_name'].strip()
|
||||
match = re.match(r"^.*(\d+)\.(\d+)\.(\d+).*$", tag)
|
||||
match = re.match(r'^.*(\d+)\.(\d+)\.(\d+).*$', tag)
|
||||
|
||||
if len(match.groups()) != 3:
|
||||
print(f"Version '{tag}' did not match expected pattern")
|
||||
@ -64,7 +64,7 @@ def check_version_number(version_string, allow_duplicate=False):
|
||||
print(f"Checking version '{version_string}'")
|
||||
|
||||
# Check that the version string matches the required format
|
||||
match = re.match(r"^(\d+)\.(\d+)\.(\d+)(?: dev)?$", version_string)
|
||||
match = re.match(r'^(\d+)\.(\d+)\.(\d+)(?: dev)?$', version_string)
|
||||
|
||||
if not match or len(match.groups()) != 3:
|
||||
raise ValueError(
|
||||
@ -85,7 +85,7 @@ def check_version_number(version_string, allow_duplicate=False):
|
||||
|
||||
if release > version_tuple:
|
||||
highest_release = False
|
||||
print(f"Found newer release: {str(release)}")
|
||||
print(f'Found newer release: {str(release)}')
|
||||
|
||||
return highest_release
|
||||
|
||||
@ -104,10 +104,10 @@ if __name__ == '__main__':
|
||||
GITHUB_BASE_REF = os.environ['GITHUB_BASE_REF']
|
||||
|
||||
# Print out version information, makes debugging actions *much* easier!
|
||||
print(f"GITHUB_REF: {GITHUB_REF}")
|
||||
print(f"GITHUB_REF_NAME: {GITHUB_REF_NAME}")
|
||||
print(f"GITHUB_REF_TYPE: {GITHUB_REF_TYPE}")
|
||||
print(f"GITHUB_BASE_REF: {GITHUB_BASE_REF}")
|
||||
print(f'GITHUB_REF: {GITHUB_REF}')
|
||||
print(f'GITHUB_REF_NAME: {GITHUB_REF_NAME}')
|
||||
print(f'GITHUB_REF_TYPE: {GITHUB_REF_TYPE}')
|
||||
print(f'GITHUB_BASE_REF: {GITHUB_BASE_REF}')
|
||||
|
||||
version_file = os.path.join(here, '..', 'InvenTree', 'InvenTree', 'version.py')
|
||||
|
||||
@ -120,7 +120,7 @@ if __name__ == '__main__':
|
||||
results = re.findall(r'INVENTREE_SW_VERSION = "(.*)"', text)
|
||||
|
||||
if len(results) != 1:
|
||||
print(f"Could not find INVENTREE_SW_VERSION in {version_file}")
|
||||
print(f'Could not find INVENTREE_SW_VERSION in {version_file}')
|
||||
sys.exit(1)
|
||||
|
||||
version = results[0]
|
||||
@ -164,15 +164,15 @@ if __name__ == '__main__':
|
||||
docker_tags = ['latest']
|
||||
|
||||
else:
|
||||
print("Unsupported branch / version combination:")
|
||||
print(f"InvenTree Version: {version}")
|
||||
print("GITHUB_REF_TYPE:", GITHUB_REF_TYPE)
|
||||
print("GITHUB_BASE_REF:", GITHUB_BASE_REF)
|
||||
print("GITHUB_REF:", GITHUB_REF)
|
||||
print('Unsupported branch / version combination:')
|
||||
print(f'InvenTree Version: {version}')
|
||||
print('GITHUB_REF_TYPE:', GITHUB_REF_TYPE)
|
||||
print('GITHUB_BASE_REF:', GITHUB_BASE_REF)
|
||||
print('GITHUB_REF:', GITHUB_REF)
|
||||
sys.exit(1)
|
||||
|
||||
if docker_tags is None:
|
||||
print("Docker tags could not be determined")
|
||||
print('Docker tags could not be determined')
|
||||
sys.exit(1)
|
||||
|
||||
print(f"Version check passed for '{version}'!")
|
||||
@ -181,9 +181,9 @@ if __name__ == '__main__':
|
||||
# Ref: https://getridbug.com/python/how-to-set-environment-variables-in-github-actions-using-python/
|
||||
with open(os.getenv('GITHUB_ENV'), 'a') as env_file:
|
||||
# Construct tag string
|
||||
tags = ",".join([f"inventree/inventree:{tag}" for tag in docker_tags])
|
||||
tags = ','.join([f'inventree/inventree:{tag}' for tag in docker_tags])
|
||||
|
||||
env_file.write(f"docker_tags={tags}\n")
|
||||
env_file.write(f'docker_tags={tags}\n')
|
||||
|
||||
if GITHUB_REF_TYPE == 'tag' and highest_release:
|
||||
env_file.write("stable_release=true\n")
|
||||
env_file.write('stable_release=true\n')
|
||||
|
Reference in New Issue
Block a user