Merge 'origin/integration' into MBP-127-commit-files-with-lf-in-repo-crlf
Conflicts: solution/solution.tsproj twincat_version_manager.py
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4024.0">
|
||||
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4023.119">
|
||||
<DataTypes>
|
||||
<DataType>
|
||||
<Name GUID="{4C3FC5AC-D5AA-44C6-AC5A-159774BA0F6D}" Namespace="MC" TcBaseType="true" HideType="true" IecDeclaration="DWORD;">NCTOPLC_AXIS_REF_STATE</Name>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import glob
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
VERSION_TAGS = {"**/*.Tc*": "ProductVersion", "**/*.tsproj": "TcVersion"}
|
||||
CORRECT_VERSION = "3.1.4024.0"
|
||||
VERSION_TAGS = {"**/*.Tc*": "ProductVersion", "**/*.tsproj": "TcVersion"}
|
||||
CORRECT_VERSIONS = {"**/*.Tc*": "3.1.4024.0", "**/*.tsproj": "3.1.4023.119"}
|
||||
|
||||
|
||||
def check_versions():
|
||||
@@ -12,8 +12,10 @@ def check_versions():
|
||||
listed in VERSION_TAGS.
|
||||
:return: A dictionary of incorrect files and their version numbers
|
||||
"""
|
||||
incorrect_files = dict()
|
||||
incorrect_files_exp = dict()
|
||||
incorrect_files_act = dict()
|
||||
for file_path, version_attrib in VERSION_TAGS.items():
|
||||
correct_version = CORRECT_VERSIONS[file_path]
|
||||
found_files = glob.glob(file_path, recursive=True)
|
||||
if not found_files:
|
||||
raise IOError("ERROR: No files of type {} found".format(file_path))
|
||||
@@ -21,19 +23,21 @@ def check_versions():
|
||||
tree = ET.parse(file)
|
||||
try:
|
||||
found_version = tree.getroot().attrib[version_attrib]
|
||||
if found_version != CORRECT_VERSION:
|
||||
incorrect_files[file] = found_version
|
||||
if found_version != correct_version:
|
||||
incorrect_files_exp[file] = correct_version
|
||||
incorrect_files_act[file] = found_version
|
||||
except KeyError:
|
||||
print("WARNING: No version found for {}".format(file))
|
||||
return incorrect_files
|
||||
return incorrect_files_exp, incorrect_files_act
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
incorrect_files = check_versions()
|
||||
for file, version in incorrect_files.items():
|
||||
print("ERROR: {} has incorrect version {}, expected version {}".format(file, version, CORRECT_VERSION))
|
||||
if incorrect_files:
|
||||
incorrect_files_exp, incorrect_files_act = check_versions()
|
||||
for file, version in incorrect_files_act.items():
|
||||
correct_version = incorrect_files_exp[file]
|
||||
print("ERROR: {} has incorrect version {}, expected version {}".format(file, version, correct_version))
|
||||
if incorrect_files_act:
|
||||
exit(1)
|
||||
except IOError as e:
|
||||
print(e) # Likely no files found
|
||||
|
||||
Reference in New Issue
Block a user