MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_version_from_subject_line

Function get_version_from_subject_line

src/packagedcode/msi.py:105–120  ·  view source on GitHub ↗

Return a version number from `subject_line` `subject_line` is the `Subject` field from the output of `msiinfo suminfo `. This string sometimes contains the version number of the package contained in the MSI installer.

(subject_line)

Source from the content-addressed store, hash-verified

103
104
105def get_version_from_subject_line(subject_line):
106 """
107 Return a version number from `subject_line`
108
109 `subject_line` is the `Subject` field from the output of
110 `msiinfo suminfo <msi installer file>`. This string sometimes contains
111 the version number of the package contained in the MSI installer.
112 """
113 for pattern in VERSION_PATTERNS_REGEX():
114 version = re.search(pattern, subject_line)
115 if version:
116 v = version.group(0)
117 # prefix with v space
118 if not v.lower().startswith('v'):
119 v = f'v {v}'
120 return v
121
122
123def create_package_data_from_msiinfo_results(

Calls 3

VERSION_PATTERNS_REGEXFunction · 0.90
groupMethod · 0.80
searchMethod · 0.45

Tested by

no test coverage detected