@@ -62,16 +62,26 @@ def diff_dict_keys(a, b):
6262
6363
6464def check_diff (tag , actual , expected , ign_a = "" , ign_e = "" , exp_a = [], win = False ):
65+ """
66+ :param tag: tag for logging
67+ :param actual: {filename: size} dict of actually found files
68+ :param expected: {filename: size} dict of expected files
69+ :param ign_a: regex for ignoring superfluous files that are in actual but not in expected
70+ :param ign_e: regex for ignoring missing files that are in expected but not in actual
71+ :param exp_a: list of additional file names that need to be present in actual, independent of expected
72+ :param win: on windows, we ignore file sizes
73+ """
6574 global issues
6675 print ("\t Checking" , tag )
67- if win :
68- actual , expected = diff_dict_keys (actual , expected )
69- else :
70- actual , expected = diff_dicts (actual , expected )
7176 for e in exp_a :
7277 if e not in actual :
7378 print ("\t Missing file %s in %s!" % (e , tag ))
7479 issues += 1
80+
81+ if win : # ignore file sizes on windows
82+ actual , expected = diff_dict_keys (actual , expected )
83+ else :
84+ actual , expected = diff_dicts (actual , expected )
7585 sup = {k : v for k , v in actual .items () if not re .fullmatch (ign_a , k ) and k not in exp_a }
7686 mis = {k : v for k , v in expected .items () if not re .fullmatch (ign_e , k )}
7787 if sup or mis :
@@ -91,7 +101,7 @@ def ignore(*ps):
91101]
92102
93103
94- def check_wheel (wheelp , ogdfp , name , tag ):
104+ def check_wheel (wheelp , ogdfp , name , tag , config ):
95105 name_esc = ignore (name )
96106 headers , others = {}, {}
97107 for k , v in ogdfp ["include/" ].items ():
@@ -100,7 +110,8 @@ def check_wheel(wheelp, ogdfp, name, tag):
100110 else :
101111 others [k ] = v
102112
103- # _cur is the install location for the current platform (UNIX), _oth for the other (Windows)
113+ # _cur is the install location for the current target platform (default UNIX), _oth for the other (Windows)
114+ # only one of them will actually contain files, depending on the target platform
104115 incl_cur , incl_oth = wheelp [name + ".data/data/include/" ], wheelp ["ogdf_wheel/install/include/" ]
105116 exam_cur , exam_oth = wheelp [name + ".data/data/share/doc/libogdf/examples/" ], wheelp ["ogdf_wheel/install/share/doc/libogdf/examples/" ]
106117 check = check_diff
@@ -109,7 +120,11 @@ def check_wheel(wheelp, ogdfp, name, tag):
109120 exam_cur , exam_oth = exam_oth , exam_cur
110121 check = partial (check_diff , win = True )
111122
112- check ("wheel includes [cur]" , incl_cur , headers , exp_a = ["ogdf/basic/internal/config_autogen.h" ])
123+ if config :
124+ check ("wheel includes [cur]" , incl_cur , headers , exp_a = [f"ogdf-{ config } /ogdf/basic/internal/config_autogen.h" ])
125+ else :
126+ check ("wheel includes [cur]" , incl_cur , headers ,
127+ exp_a = ["ogdf-debug/ogdf/basic/internal/config_autogen.h" , "ogdf-release/ogdf/basic/internal/config_autogen.h" ])
113128 check ("wheel includes [oth]" , incl_oth , {})
114129 check ("wheel examples [cur]" , exam_cur , ogdfp ["doc/examples/" ], ign_e = IGNORE_GIT + "|.*\\ .dox" )
115130 check ("wheel examples [oth]" , exam_oth , {})
@@ -121,21 +136,32 @@ def check_wheel(wheelp, ogdfp, name, tag):
121136 'ogdf/lib/minisat/doc/ReleaseNotes-2.2.0.txt' : 3418 ,
122137 'ogdf/geometric/README.md' : 321 })
123138
124- ign_meta = f"{ name_esc } \\ .dist-info/(METADATA|RECORD|WHEEL)|{ name_esc } \\ .data/data/lib/cmake/.*\.cmake"
139+ def expand_suffix (* paths , pre = "" ):
140+ ret = []
141+ if config != "release" :
142+ ret .extend (pre + p .replace ("{suffix}" , "-debug" ) for p in paths )
143+ if config != "debug" :
144+ ret .extend (pre + p .replace ("{suffix}" , "" ) for p in paths )
145+ return ret
146+
147+ ign_meta = f"{ name_esc } \\ .dist-info/(METADATA|RECORD|WHEEL)|{ name_esc } \\ .data/data/(lib/cmake|share/ogdf)/.*\\ .cmake"
125148 exp_lic = [name + ".dist-info/licenses/" + f for f in LICENSES ] + ['ogdf_wheel/__init__.py' ]
126149 if "win" in tag :
127150 check ("wheel install [win]" , wheelp ["ogdf_wheel/install/" ], {},
128- ign_a = "lib/cmake/.*\.cmake|lib/(COIN|OGDF)\.lib" ,
129- exp_a = ["bin/OGDF.dll" ])
151+ ign_a = "lib/cmake/.*\\ .cmake|lib/(COIN|OGDF)" + ('(-debug)' if config != 'release' else '' )
152+ + ('' if config else '?' ) + "\\ .lib" ,
153+ exp_a = expand_suffix ("bin/OGDF{suffix}.dll" ))
130154 check ("wheel rest [win]" , wheelp ["" ], {}, ign_a = ign_meta , exp_a = exp_lic )
131155 elif "macos" in tag :
132156 check ("wheel rest [macos]" , wheelp ["" ], {},
133157 ign_a = ign_meta ,
134- exp_a = [name + ".data/data/lib/libOGDF.dylib" , name + ".data/data/lib/libCOIN.dylib" , * exp_lic ])
158+ exp_a = expand_suffix ("libOGDF{suffix}.dylib" , "libCOIN{suffix}.dylib" , pre = name + ".data/data/lib/" )
159+ + exp_lic )
135160 else :
136161 check ("wheel rest [linux]" , wheelp ["" ], {},
137- ign_a = ign_meta ,
138- exp_a = [name + ".data/data/lib/libOGDF.so" , name + ".data/data/lib/libCOIN.so" , * exp_lic ])
162+ ign_a = ign_meta + f"|{ name } .data/data/lib(64)?/lib.*\\ .so\\ .[0-9]+\\ .[0-9]+" ,
163+ exp_a = expand_suffix ("libOGDF{suffix}.so" , "libCOIN{suffix}.so" , pre = name + ".data/data/lib/" )
164+ + exp_lic )
139165
140166
141167def check_sdist (sdistp , ogdff ):
@@ -162,7 +188,8 @@ def dump_data(dumpdir, files, partitions, name):
162188 @click .option ('--dist' , type = click .Path (exists = True , file_okay = False ), default = Path ("dist" ))
163189 @click .option ('--ogdf' , type = click .Path (exists = True , file_okay = False ), default = Path ("ogdf" ))
164190 @click .option ('--dump' , type = click .Path (file_okay = False ))
165- def main (dist , ogdf , dump ):
191+ @click .option ('--config' , default = "" )
192+ def main (dist , ogdf , dump , config ):
166193 dist = Path (dist )
167194 ogdf = Path (ogdf )
168195 dump = Path (dump ) if dump else dump
@@ -194,7 +221,7 @@ def main(dist, ogdf, dump):
194221 name + ".data/data/include/" , name + ".data/data/share/doc/libogdf/examples/" ,
195222 "ogdf_wheel/install/include/" , "ogdf_wheel/install/share/doc/libogdf/examples/" , "ogdf_wheel/install/" ])
196223 if dump : dump_data (dump , wheelf , wheelp , "wheel-%s" % wheel .name )
197- check_wheel (wheelp , ogdfp , name , wheel .stem )
224+ check_wheel (wheelp , ogdfp , name , wheel .stem , config )
198225
199226 if issues :
200227 print ("There were %s issue(s)!" % issues )
0 commit comments