Remove no longer used enterprises.tsv file

Follow-up to 44258d5bed.
This commit is contained in:
João Valverde 2023-07-05 22:52:17 +01:00
parent fcb6bb5763
commit f47ce6e761
6 changed files with 18 additions and 60649 deletions

View File

@ -2040,7 +2040,6 @@ set(INSTALL_DIRS
# Installed into ${DATAFILE_DIR}
set(INSTALL_FILES
enterprises.tsv
manuf
resources/share/wireshark/cfilters
resources/share/wireshark/colorfilters

File diff suppressed because it is too large Load Diff

View File

@ -507,9 +507,6 @@ File "${STAGING_DIR}\colorfilters"
;IfFileExists dfilters dont_overwrite_dfilters
File "${STAGING_DIR}\dfilters"
;dont_overwrite_dfilters:
;IfFileExists enterprises.tsv dont_overwrite_enterprises_tsv
File "${STAGING_DIR}\enterprises.tsv"
;dont_overwrite_dfilters:
;IfFileExists smi_modules dont_overwrite_smi_modules
File "${STAGING_DIR}\smi_modules"
;dont_overwrite_smi_modules:

View File

@ -599,9 +599,6 @@ File "${STAGING_DIR}\colorfilters"
;IfFileExists dfilters dont_overwrite_dfilters
File "${STAGING_DIR}\dfilters"
;dont_overwrite_dfilters:
;IfFileExists enterprises.tsv dont_overwrite_enterprises_tsv
File "${STAGING_DIR}\enterprises.tsv"
;dont_overwrite_dfilters:
;IfFileExists smi_modules dont_overwrite_smi_modules
File "${STAGING_DIR}\smi_modules"
;dont_overwrite_smi_modules:

View File

@ -109,9 +109,6 @@
<Component Id="cmpDfilters" Guid="*">
<File Id="filDfilters" KeyPath="yes" Source="$(var.Staging.Dir)\dfilters" />
</Component>
<Component Id="cmpEnterprisesTsv" Guid="*">
<File Id="filEnterprisesTsv" KeyPath="yes" Source="$(var.Staging.Dir)\enterprises.tsv" />
</Component>
<Component Id="cmpSmi_modules" Guid="*">
<File Id="filSmi_modules" KeyPath="yes" Source="$(var.Staging.Dir)\smi_modules" />
</Component>

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3
# create the enterprises.tsv file from
# create the global_enterprise_entries.c file from
# https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers
# or an offline copy
#
@ -145,9 +145,9 @@ class CFile:
def main():
parser = argparse.ArgumentParser(description="Create the enterprises.tsv file.")
parser.add_argument('infile', nargs='?')
parser.add_argument('outfile', nargs=1)
parser = argparse.ArgumentParser(description="Create the global_enterprise_entries.c file.")
parser.add_argument('--infile')
parser.add_argument('outfile', nargs='?', default=os.path.join('epan', 'global_enterprise_entries.c'))
parsed_args = parser.parse_args()
# Read data from file or webpage
@ -160,29 +160,24 @@ def main():
raise Exception("request for " + ENTERPRISE_NUMBERS_URL + " failed with result code " + f.status)
data = f.read().decode('utf-8')
# Find bits we need and write them to file
# Find bits we need and generate enterprise entries
enterprises_content = generate_enterprise_files(data)
with open(parsed_args.outfile[0], encoding='utf-8', mode='w') as fh:
fh.write(enterprises_content)
# Now write to a C file the contents (which is faster than parsing the global file at runtime).
with open(parsed_args.outfile[0], 'r') as tsv_f:
c_file = CFile(os.path.join('epan', 'global_enterprise_entries.c'))
c_file = CFile(parsed_args.outfile)
# Find all mappings from .tsv file
lines = tsv_f.read().splitlines()
mapping_re = re.compile(r'^(\d+)\s+(.*)$')
for line in lines:
match = mapping_re.match(line)
if match:
num, name = match.group(1), match.group(2)
# Strip any comments and/or trailing whitespace
idx = name.find('#')
if idx != -1:
name = name[0:idx]
name = name.rstrip()
# Add
c_file.addMapping(int(num), name)
mapping_re = re.compile(r'^(\d+)\s+(.*)$')
for line in enterprises_content.splitlines():
match = mapping_re.match(line)
if match:
num, name = match.group(1), match.group(2)
# Strip any comments and/or trailing whitespace
idx = name.find('#')
if idx != -1:
name = name[0:idx]
name = name.rstrip()
# Add
c_file.addMapping(int(num), name)