scanpypi: don't pass any arguments to main()
PATCH 1/2 scanpypi: don't pass any arguments to main()
'if __name__ == "__main__"' idiom typically calls main function that doesn't take any arguments in most cases. We shouldn't pass any tuple to it.
I've tested the script with python-idna-2.5 and now it works with this little change.
--- utils/scanpypi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
utils/scanpypi +2 -2
@@ -255,12 +255,12 @@ class BuildrootPackage(): # called through the if __name__ == '__main__' directive. # In this case, we can only pray that it is called through a # function called main() in setup.py. - setup.main([]) # Will raise AttributeError if not found + setup.main() # Will raise AttributeError if not found self.setup_metadata = self.setup_args[self.metadata_name] # Here we must remove the module the hard way. # We must do this because of a very specific case: if a package calls # setup from the __main__ but does not come with a 'main()' function, - # for some reason setup.main([]) will successfully call the main + # for some reason setup.main() will successfully call the main # function of a previous package... sys.modules.pop('setup',None) del setup
Signature · 1 line
2.13.0
PATCH 2/2 scanpypi: include LICENSE.RST in the list of supported license files
--- utils/scanpypi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
utils/scanpypi +2 -2
@@ -416,8 +416,8 @@ class BuildrootPackage(): license=', '.join(licenses)) lines.append(license_line) - filenames = ['LICENCE', 'LICENSE', 'LICENSE.TXT', 'COPYING', - 'COPYING.TXT'] + filenames = ['LICENCE', 'LICENSE', 'LICENSE.RST', 'LICENSE.TXT', + 'COPYING', 'COPYING.TXT'] license_files = list(find_file_upper_case(filenames, self.tmp_extract)) license_files = [license.replace(self.tmp_extract, '')[1:] for license in license_files]
Signature · 1 line
2.13.0
PATCH 2/2 scanpypi: include LICENSE.RST in the list of supported license files
Quoted 1 line · Alexey Roslyakov
Signed-off-by Alexey Roslyakov <[email protected]>
Quoted 22 lines
--- utils/scanpypi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)utils/scanpypi +2
-3@@ -416,8 +416,8 @@ class BuildrootPackage(): license=', '.join(licenses)) lines.append(license_line) - filenames = ['LICENCE', 'LICENSE', 'LICENSE.TXT', 'COPYING', - 'COPYING.TXT'] + filenames = ['LICENCE', 'LICENSE', 'LICENSE.RST', 'LICENSE.TXT', + 'COPYING', 'COPYING.TXT'] license_files = list(find_file_upper_case(filenames, self.tmp_extract)) license_files = [license.replace(self.tmp_extract, '')[1:] for license in license_files] --2.13.0
PATCH 1/2 scanpypi: don't pass any arguments to main()
In reply to Alexey RoslyakovHi Alexey,
Quoted 7 lines · Alexey Roslyakov
'if
__name__== "__main__"' idiom typically calls main function that doesn't take any arguments in most cases. We shouldn't pass any tuple to it.
I've tested the script with python-idna-2.5 and now it works with this little change.Signed-off-by Alexey Roslyakov <[email protected]>
Good catch! I've tested it with cbor and it is now working like a charm.
Quoted 26 lines
--- utils/scanpypi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)utils/scanpypi +2
-3@@ -255,12 +255,12 @@ class BuildrootPackage(): # called through the if __name__ == '__main__' directive. # In this case, we can only pray that it is called through a # function called main() in setup.py. - setup.main([]) # Will raise AttributeError if not found + setup.main() # Will raise AttributeError if not found self.setup_metadata = self.setup_args[self.metadata_name] # Here we must remove the module the hard way. # We must do this because of a very specific case: if a package calls # setup from the __main__ but does not come with a 'main()' function, - # for some reason setup.main([]) will successfully call the main + # for some reason setup.main() will successfully call the main # function of a previous package... sys.modules.pop('setup',None) del setup --2.13.0
PATCH 1/2 scanpypi: don't pass any arguments to main()
In reply to Alexey RoslyakovHello,
Quoted 10 lines · Alexey Roslyakov
'if
__name__== "__main__"' idiom typically calls main function that doesn't take any arguments in most cases. We shouldn't pass any tuple to it.
I've tested the script with python-idna-2.5 and now it works with this little change.Signed-off-by Alexey Roslyakov <[email protected]>--- utils/scanpypi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Both patches applied. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com