mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Documentation URL is now hard-coded
- Also checked as part of CI step
This commit is contained in:
parent
8dddb200c7
commit
cfbcb80285
@ -8,8 +8,15 @@ import re
|
||||
|
||||
import common.models
|
||||
|
||||
# InvenTree software version
|
||||
INVENTREE_SW_VERSION = "0.6.0 dev"
|
||||
|
||||
# InvenTree documentation version
|
||||
# For 'dev' branch this must read "latest"
|
||||
# For 'stable' branch this must match INVENTREE_SW_VERSION
|
||||
INVENTREE_DOCS_VERSION = "latest"
|
||||
|
||||
# InvenTree API version
|
||||
INVENTREE_API_VERSION = 15
|
||||
|
||||
"""
|
||||
@ -112,12 +119,7 @@ def inventreeDocsVersion():
|
||||
|
||||
"""
|
||||
|
||||
if isInvenTreeDevelopmentVersion():
|
||||
return "latest"
|
||||
else:
|
||||
major, minor, patch = inventreeVersionTuple()
|
||||
|
||||
return f"{major}.{minor}.{patch}"
|
||||
return INVENTREE_DOCS_VERSION
|
||||
|
||||
|
||||
def isInvenTreeUpToDate():
|
||||
|
@ -9,6 +9,7 @@ import sys
|
||||
import re
|
||||
import os
|
||||
import argparse
|
||||
import requests
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@ -16,9 +17,15 @@ if __name__ == '__main__':
|
||||
|
||||
version_file = os.path.join(here, '..', 'InvenTree', 'InvenTree', 'version.py')
|
||||
|
||||
version = None
|
||||
docs_version = None
|
||||
|
||||
with open(version_file, 'r') as f:
|
||||
|
||||
results = re.findall(r'INVENTREE_SW_VERSION = "(.*)"', f.read())
|
||||
text = f.read()
|
||||
|
||||
# Extract the InvenTree software version
|
||||
results = re.findall(r'INVENTREE_SW_VERSION = "(.*)"', text)
|
||||
|
||||
if not len(results) == 1:
|
||||
print(f"Could not find INVENTREE_SW_VERSION in {version_file}")
|
||||
@ -26,6 +33,18 @@ if __name__ == '__main__':
|
||||
|
||||
version = results[0]
|
||||
|
||||
# Extract the documentation version
|
||||
results = re.findall(r'INVENTREE_DOCS_VERSION = "(.*)"', text)
|
||||
|
||||
if not len(results) == 1:
|
||||
print(f"Could not find INVENTREE_DOCS_VERSION in '{version_file}'")
|
||||
sys.exit(1)
|
||||
|
||||
docs_version = results[0]
|
||||
|
||||
print(f"InvenTree Version: '{version}'")
|
||||
print(f"Documentation Version: '{docs_version}'")
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-t', '--tag', help='Compare against specified version tag', action='store')
|
||||
parser.add_argument('-r', '--release', help='Check that this is a release version', action='store_true')
|
||||
@ -57,6 +76,8 @@ if __name__ == '__main__':
|
||||
e.g. "0.5 dev"
|
||||
"""
|
||||
|
||||
print(f"Checking development branch")
|
||||
|
||||
pattern = "^\d+(\.\d+)+ dev$"
|
||||
|
||||
result = re.match(pattern, version)
|
||||
@ -65,12 +86,19 @@ if __name__ == '__main__':
|
||||
print(f"Version number '{version}' does not match required pattern for development branch")
|
||||
sys.exit(1)
|
||||
|
||||
# The docs version must be 'latest'
|
||||
if docs_version != 'latest':
|
||||
print(f"Documentation version must be 'latest' for development branch")
|
||||
sys.exit(1)
|
||||
|
||||
elif args.release:
|
||||
"""
|
||||
Check that the current version number matches the "release" format
|
||||
e.g. "0.5.1"
|
||||
"""
|
||||
|
||||
print(f"Checking release branch")
|
||||
|
||||
pattern = "^\d+(\.\d+)+$"
|
||||
|
||||
result = re.match(pattern, version)
|
||||
@ -84,4 +112,15 @@ if __name__ == '__main__':
|
||||
print(f"Release tag '{args.tag}' does not match INVENTREE_SW_VERSION '{version}'")
|
||||
sys.exit(1)
|
||||
|
||||
# Check that the documentation URL is available
|
||||
url = f"https://inventree.readthedocs.io/en/{docs_version}"
|
||||
|
||||
print(f"Checking documentation url: {url}")
|
||||
|
||||
response = requests.get(url)
|
||||
|
||||
if response.status_code != 200:
|
||||
print(f"ERROR: Received status code {response.status_code}")
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
Loading…
Reference in New Issue
Block a user