@@ -34,7 +34,6 @@ class RPMSpecFileGenerator:
3434 "%description -n %{{name}}-data" ,
3535 "{description:s}" ,
3636 "" ,
37- "" ,
3837 ]
3938
4039 _SPEC_TEMPLATE_PYTHON3_BODY = [
@@ -47,7 +46,6 @@ class RPMSpecFileGenerator:
4746 "%install" ,
4847 "%pyproject_install" ,
4948 "" ,
50- "" ,
5149 ]
5250
5351 _SPEC_TEMPLATE_TOOLS_PACKAGE_DEFINITION = [
@@ -58,7 +56,6 @@ class RPMSpecFileGenerator:
5856 "%description -n %{{name}}-tools" ,
5957 "{description:s}" ,
6058 "" ,
61- "" ,
6259 ]
6360
6461 LOG_FILENAME = "build.log"
@@ -107,7 +104,6 @@ def _GenerateSpecFile(
107104 "vendor" : None ,
108105 "version" : None ,
109106 }
110-
111107 has_data_package = False
112108
113109 python_module_name = project_name
@@ -124,7 +120,6 @@ def _GenerateSpecFile(
124120 os .path .isdir (tools_directory )
125121 and glob .glob (os .path .join (tools_directory , "*.py" ))
126122 )
127-
128123 if project_definition .srpm_name :
129124 package_name = project_definition .srpm_name
130125 elif project_definition .rpm_name :
@@ -167,7 +162,11 @@ def _GenerateSpecFile(
167162 )
168163
169164 if not configuration ["license" ]:
170- configuration ["license" ] = pyproject_toml_project .get ("license" , None )
165+ license_value = pyproject_toml_project .get ("license" )
166+ if isinstance (license_value , dict ):
167+ license_value = license_value .get ("text" )
168+
169+ configuration ["license" ] = license_value
171170
172171 if not configuration ["summary" ]:
173172 configuration ["summary" ] = pyproject_toml_project .get (
@@ -262,7 +261,6 @@ def _GenerateSpecFile(
262261 build_requires ,
263262 configuration ,
264263 )
265-
266264 if project_name != package_name :
267265 python_package_name = f"python3-{ package_name :s} "
268266 else :
@@ -278,7 +276,6 @@ def _GenerateSpecFile(
278276 configuration ,
279277 output_file_object ,
280278 )
281-
282279 if has_tools_package :
283280 self ._WriteToolsPackageDefinition (output_file_object , configuration )
284281
@@ -299,7 +296,6 @@ def _GenerateSpecFile(
299296 license_line ,
300297 doc_line ,
301298 )
302-
303299 if has_tools_package :
304300 self ._WriteToolsPackageFiles (output_file_object )
305301
@@ -351,14 +347,14 @@ def _GetInstallDefinition(self, project_name):
351347 ),
352348 "rm -rf %{buildroot}/usr/share/doc/%{name}/" ,
353349 ]
354-
355350 if project_name == "astroid" :
356351 lines .extend (["rm -rf %{buildroot}%{python3_sitelib}/astroid/tests" ])
357352
358353 elif project_name == "pylint" :
359354 lines .extend (["rm -rf %{buildroot}%{python3_sitelib}/pylint/test" ])
360355
361356 lines .append ("" )
357+
362358 return "\n " .join (lines )
363359
364360 def _GetLicenseFileDefinition (self , source_directory ):
@@ -441,11 +437,9 @@ def _WriteChangeLog(self, output_file_object, version):
441437 date_time_string = date_time .strftime ("%a %b %e %Y" )
442438
443439 output_file_object .write (
444- (
445- "%changelog\n "
446- f"* { date_time_string :s} { self ._EMAIL_ADDRESS :s} { version :s} -1\n "
447- "- Auto-generated\n "
448- )
440+ "%changelog\n "
441+ f"* { date_time_string :s} { self ._EMAIL_ADDRESS :s} { version :s} -1\n "
442+ "- Auto-generated\n "
449443 )
450444
451445 def _WriteDataPackageDefinition (self , output_file_object , configuration ):
@@ -459,7 +453,6 @@ def _WriteDataPackageDefinition(self, output_file_object, configuration):
459453 "description" : configuration ["description" ],
460454 "summary" : configuration ["summary" ],
461455 }
462-
463456 output_string = "\n " .join (self ._SPEC_TEMPLATE_DATA_PACKAGE_DEFINITION )
464457 output_string = output_string .format (** template_mappings )
465458 output_file_object .write (output_string )
@@ -477,9 +470,7 @@ def _WriteDataPackageFiles(self, output_file_object):
477470 "%doc ACKNOWLEDGEMENTS AUTHORS README.md" ,
478471 "%{_datadir}/%{name}/*" ,
479472 "" ,
480- "" ,
481473 ]
482-
483474 output_string = "\n " .join (template )
484475 output_file_object .write (output_string )
485476
@@ -536,7 +527,6 @@ def _WritePython3PackageDefinition(
536527 "requires" : ", " .join (requires ),
537528 "summary" : configuration ["summary" ],
538529 }
539-
540530 template = ["%package -n {name:s}" ]
541531
542532 if requires :
@@ -549,10 +539,8 @@ def _WritePython3PackageDefinition(
549539 "%description -n {name:s}" ,
550540 "{description:s}" ,
551541 "" ,
552- "" ,
553542 ]
554543 )
555-
556544 output_string = "\n " .join (template )
557545 output_string = output_string .format (** template_mappings )
558546 output_file_object .write (output_string )
@@ -592,7 +580,6 @@ def _WritePython3PackageFiles(
592580 "name" : name ,
593581 "setup_name" : setup_name ,
594582 }
595-
596583 template = ["%files -n {name:s}" , "{license:s}" , "{doc:s}" ]
597584
598585 if project_definition .architecture_dependent :
@@ -602,7 +589,6 @@ def _WritePython3PackageFiles(
602589 "%{{_libdir}}/python3*/site-packages/{setup_name:s}*.dist-info" ,
603590 ]
604591 )
605-
606592 else :
607593 template .extend (
608594 [
@@ -648,7 +634,6 @@ def _WriteSpecFileFromTempate(
648634 "rpm_requires" : ", " .join (rpm_requires ),
649635 "version" : project_version ,
650636 }
651-
652637 template_file_path = os .path .join (
653638 self ._data_path , "rpm_templates" , project_definition .rpm_template_spec
654639 )
@@ -700,7 +685,6 @@ def _WriteSourcePackageDefinition(
700685 "vendor" : configuration ["vendor" ],
701686 "version" : configuration ["version" ],
702687 }
703-
704688 template = [
705689 "Name: {name:s}" ,
706690 "Version: {version:s}" ,
@@ -711,7 +695,6 @@ def _WriteSourcePackageDefinition(
711695 "Url: {url:s}" ,
712696 "Vendor: {vendor:s}" ,
713697 ]
714-
715698 template .append ("Source0: {source:s}" )
716699
717700 if not project_definition .architecture_dependent :
@@ -728,10 +711,8 @@ def _WriteSourcePackageDefinition(
728711 "%description" ,
729712 "{description:s}" ,
730713 "" ,
731- "" ,
732714 ]
733715 )
734-
735716 output_string = "\n " .join (template )
736717 output_string = output_string .format (** template_mappings )
737718 output_file_object .write (output_string )
@@ -748,7 +729,6 @@ def _WriteToolsPackageDefinition(self, output_file_object, configuration):
748729 "project_name" : configuration ["name" ],
749730 "summary" : configuration ["summary" ],
750731 }
751-
752732 output_string = "\n " .join (self ._SPEC_TEMPLATE_TOOLS_PACKAGE_DEFINITION )
753733 output_string = output_string .format (** template_mappings )
754734 output_file_object .write (output_string )
@@ -790,7 +770,6 @@ def Generate(
790770 "python3-setuptools" ,
791771 "python3-wheel" ,
792772 ]
793-
794773 if project_definition .architecture_dependent :
795774 rpm_build_dependencies .append ("gcc" )
796775
0 commit comments