mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
don't copy {topdir}/COPYING to auto-generated files, following a
suggestion in code review. git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@986 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
@@ -36,7 +36,14 @@ class_definitions = ''
|
|||||||
classdir_mtime = 0
|
classdir_mtime = 0
|
||||||
rdatadef_mtime = 0
|
rdatadef_mtime = 0
|
||||||
rdatahdr_mtime = 0
|
rdatahdr_mtime = 0
|
||||||
copyright_file = '@top_srcdir@' + os.sep + 'COPYING'
|
heading_txt = '''///////////////
|
||||||
|
///////////////
|
||||||
|
/////////////// THIS FILE IS AUTOMATICALLY GENERATED BY gen-rdatacode.py.
|
||||||
|
/////////////// DO NOT EDIT!
|
||||||
|
///////////////
|
||||||
|
///////////////
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
def import_classdef(class_txt, file):
|
def import_classdef(class_txt, file):
|
||||||
content = ''
|
content = ''
|
||||||
@@ -115,23 +122,6 @@ class MessageRenderer;\n\n'''
|
|||||||
rdata_header.close()
|
rdata_header.close()
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def import_copyright():
|
|
||||||
copyright_txt = ''
|
|
||||||
f = open(copyright_file, 'r')
|
|
||||||
for line in f.readlines():
|
|
||||||
copyright_txt += '// ' + line
|
|
||||||
f.close()
|
|
||||||
copyright_txt += '''
|
|
||||||
///////////////
|
|
||||||
///////////////
|
|
||||||
/////////////// THIS FILE IS AUTOMATICALLY GENERATED BY gen-rdatacode.py.
|
|
||||||
/////////////// DO NOT EDIT!
|
|
||||||
///////////////
|
|
||||||
///////////////
|
|
||||||
|
|
||||||
'''
|
|
||||||
return copyright_txt
|
|
||||||
|
|
||||||
def import_definitions(classcode2txt, typecode2txt, typeandclass):
|
def import_definitions(classcode2txt, typecode2txt, typeandclass):
|
||||||
global rdata_declarations
|
global rdata_declarations
|
||||||
global class_definitions
|
global class_definitions
|
||||||
@@ -189,16 +179,16 @@ def need_generate(file, mtime):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def generate_rdatadef(file, copyright_txt, basemtime):
|
def generate_rdatadef(file, basemtime):
|
||||||
if not need_generate(file, basemtime):
|
if not need_generate(file, basemtime):
|
||||||
print('skip generating ' + file);
|
print('skip generating ' + file);
|
||||||
return
|
return
|
||||||
rdata_deffile = open(file, 'w')
|
rdata_deffile = open(file, 'w')
|
||||||
rdata_deffile.write(copyright_txt)
|
rdata_deffile.write(heading_txt)
|
||||||
rdata_deffile.write(class_definitions)
|
rdata_deffile.write(class_definitions)
|
||||||
rdata_deffile.close()
|
rdata_deffile.close()
|
||||||
|
|
||||||
def generate_rdatahdr(file, copyright_txt, declarations, basemtime):
|
def generate_rdatahdr(file, declarations, basemtime):
|
||||||
if not need_generate(file, basemtime):
|
if not need_generate(file, basemtime):
|
||||||
print('skip generating ' + file);
|
print('skip generating ' + file);
|
||||||
return
|
return
|
||||||
@@ -208,7 +198,7 @@ def generate_rdatahdr(file, copyright_txt, declarations, basemtime):
|
|||||||
// End:
|
// End:
|
||||||
'''
|
'''
|
||||||
rdata_header = open(file, 'w')
|
rdata_header = open(file, 'w')
|
||||||
rdata_header.write(copyright_txt)
|
rdata_header.write(heading_txt)
|
||||||
rdata_header.write(declarations)
|
rdata_header.write(declarations)
|
||||||
rdata_header.close()
|
rdata_header.close()
|
||||||
|
|
||||||
@@ -237,7 +227,7 @@ RR''' + cap_key + '''::''' + codetxt + '''()
|
|||||||
'''
|
'''
|
||||||
header_temp = open(placeholder, 'r')
|
header_temp = open(placeholder, 'r')
|
||||||
header_out = open(outputfile, 'w')
|
header_out = open(outputfile, 'w')
|
||||||
header_out.write(copyright_txt)
|
header_out.write(heading_txt)
|
||||||
for line in header_temp.readlines():
|
for line in header_temp.readlines():
|
||||||
header_out.write(line)
|
header_out.write(line)
|
||||||
if re.match('\s+// BEGIN_WELL_KNOWN_' + upper_key + '_DECLARATIONS$', line):
|
if re.match('\s+// BEGIN_WELL_KNOWN_' + upper_key + '_DECLARATIONS$', line):
|
||||||
@@ -280,7 +270,7 @@ def generate_rrparam(fileprefix, basemtime):
|
|||||||
|
|
||||||
rrparam_temp = open(placeholder, 'r')
|
rrparam_temp = open(placeholder, 'r')
|
||||||
rrparam_out = open(outputfile, 'w')
|
rrparam_out = open(outputfile, 'w')
|
||||||
rrparam_out.write(copyright_txt)
|
rrparam_out.write(heading_txt)
|
||||||
for line in rrparam_temp.readlines():
|
for line in rrparam_temp.readlines():
|
||||||
rrparam_out.write(line)
|
rrparam_out.write(line)
|
||||||
if re.match('\s+// BEGIN_WELL_KNOWN_PARAMS', line):
|
if re.match('\s+// BEGIN_WELL_KNOWN_PARAMS', line):
|
||||||
@@ -290,12 +280,10 @@ def generate_rrparam(fileprefix, basemtime):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
copyright_txt = import_copyright()
|
|
||||||
import_definitions(classcode2txt, typecode2txt, typeandclass)
|
import_definitions(classcode2txt, typecode2txt, typeandclass)
|
||||||
generate_rdatadef('@srcdir@/rdataclass.cc', copyright_txt,
|
generate_rdatadef('@srcdir@/rdataclass.cc', rdatadef_mtime)
|
||||||
rdatadef_mtime)
|
generate_rdatahdr('@srcdir@/rdataclass.h', rdata_declarations,
|
||||||
generate_rdatahdr('@srcdir@/rdataclass.h', copyright_txt,
|
rdatahdr_mtime)
|
||||||
rdata_declarations, rdatahdr_mtime)
|
|
||||||
generate_typeclasscode('@srcdir@/rrtype',
|
generate_typeclasscode('@srcdir@/rrtype',
|
||||||
max(rdatadef_mtime, rdatahdr_mtime),
|
max(rdatadef_mtime, rdatahdr_mtime),
|
||||||
typecode2txt, 'Type')
|
typecode2txt, 'Type')
|
||||||
|
Reference in New Issue
Block a user