mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Merge pull request #2135 from SchrodingersGat/docs-fix-fix
re-simplify the documentation URL
This commit is contained in:
		| @@ -301,7 +301,9 @@ def send_email(subject, body, recipients, from_email=None): | |||||||
|  |  | ||||||
|     offload_task( |     offload_task( | ||||||
|         'django.core.mail.send_mail', |         'django.core.mail.send_mail', | ||||||
|         subject, body, |         subject, | ||||||
|  |         body, | ||||||
|         from_email, |         from_email, | ||||||
|         recipients, |         recipients, | ||||||
|  |         fail_silently=False, | ||||||
|     ) |     ) | ||||||
|   | |||||||
| @@ -11,11 +11,6 @@ import common.models | |||||||
| # InvenTree software version | # InvenTree software version | ||||||
| INVENTREE_SW_VERSION = "0.6.0 dev" | 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 | ||||||
| INVENTREE_API_VERSION = 15 | INVENTREE_API_VERSION = 15 | ||||||
|  |  | ||||||
| @@ -119,7 +114,10 @@ def inventreeDocsVersion(): | |||||||
|      |      | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|     return INVENTREE_DOCS_VERSION |     if isInvenTreeDevelopmentVersion(): | ||||||
|  |         return "latest" | ||||||
|  |     else: | ||||||
|  |         return INVENTREE_SW_VERSION | ||||||
|  |  | ||||||
|  |  | ||||||
| def isInvenTreeUpToDate(): | def isInvenTreeUpToDate(): | ||||||
|   | |||||||
| @@ -18,7 +18,6 @@ if __name__ == '__main__': | |||||||
|     version_file = os.path.join(here, '..', 'InvenTree', 'InvenTree', 'version.py') |     version_file = os.path.join(here, '..', 'InvenTree', 'InvenTree', 'version.py') | ||||||
|  |  | ||||||
|     version = None |     version = None | ||||||
|     docs_version = None |  | ||||||
|  |  | ||||||
|     with open(version_file, 'r') as f: |     with open(version_file, 'r') as f: | ||||||
|  |  | ||||||
| @@ -33,17 +32,7 @@ if __name__ == '__main__': | |||||||
|  |  | ||||||
|         version = results[0] |         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"InvenTree Version: '{version}'") | ||||||
|     print(f"Documentation Version: '{docs_version}'") |  | ||||||
|  |  | ||||||
|     parser = argparse.ArgumentParser() |     parser = argparse.ArgumentParser() | ||||||
|     parser.add_argument('-t', '--tag', help='Compare against specified version tag', action='store') |     parser.add_argument('-t', '--tag', help='Compare against specified version tag', action='store') | ||||||
| @@ -86,11 +75,6 @@ if __name__ == '__main__': | |||||||
|             print(f"Version number '{version}' does not match required pattern for development branch") |             print(f"Version number '{version}' does not match required pattern for development branch") | ||||||
|             sys.exit(1) |             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: |     elif args.release: | ||||||
|         """ |         """ | ||||||
|         Check that the current version number matches the "release" format |         Check that the current version number matches the "release" format | ||||||
| @@ -112,14 +96,4 @@ if __name__ == '__main__': | |||||||
|             print(f"Release tag '{args.tag}' does not match INVENTREE_SW_VERSION '{version}'") |             print(f"Release tag '{args.tag}' does not match INVENTREE_SW_VERSION '{version}'") | ||||||
|             sys.exit(1) |             sys.exit(1) | ||||||
|  |  | ||||||
|     # Check that the documentation URL is available |  | ||||||
|     url = f"https://inventree.readthedocs.io/en/{docs_version}" |  | ||||||
|  |  | ||||||
|     response = requests.get(url) |  | ||||||
|     print(f"Checking documentation url: {url} - Response {response.status_code}") |  | ||||||
|  |  | ||||||
|     if response.status_code != 200: |  | ||||||
|         print(f"ERROR: Received status code {response.status_code}") |  | ||||||
|         sys.exit(1) |  | ||||||
|  |  | ||||||
| sys.exit(0) | sys.exit(0) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user