@@ -164,6 +164,13 @@ def Write(self):
164164 description_long = '\n ' .join ([
165165 ' \' {0:s}\' ' .format (line ) for line in description_long ])
166166
167+ if self ._project_definition .name == 'artifacts' :
168+ data_files_path = 'share/{0:s}' .format (
169+ self ._project_definition .name )
170+ else :
171+ data_files_path = 'share/{0:s}/data' .format (
172+ self ._project_definition .name )
173+
167174 doc_files = [
168175 doc_file for doc_file in self ._DOC_FILES if os .path .isfile (doc_file )]
169176
@@ -231,6 +238,9 @@ def Write(self):
231238 '%exclude {0:s}/*.pyc' .format (python2_package_module_prefix ),
232239 '%exclude {0:s}/*.pyo' .format (python2_package_module_prefix )])
233240
241+ if scripts_directory :
242+ python2_package_files .append ('%exclude %{{_bindir}}/*.py' )
243+
234244 python2_package_files = ',\n ' .join ([
235245 ' \' {0:s}\' ' .format (package_file )
236246 for package_file in python2_package_files ])
@@ -264,13 +274,21 @@ def Write(self):
264274 python3_package_files .append (
265275 '%exclude {0:s}/__pycache__/*' .format (python3_package_module_prefix ))
266276
277+ if scripts_directory :
278+ python3_package_files .append ('%exclude %{{_bindir}}/*.py' )
279+
267280 python3_package_files = ',\n ' .join ([
268281 ' \' {0:s}\' ' .format (package_file )
269282 for package_file in python3_package_files ])
270283 python3_package_files = python3_package_files .format (
271284 self ._project_definition .name )
272285
286+ rpm_doc_files = [
287+ doc_file for doc_file in doc_files if doc_file != 'LICENSE' ]
288+ rpm_license_file = 'LICENSE'
289+
273290 template_mappings = {
291+ 'data_files_path' : data_files_path ,
274292 'doc_files' : ', ' .join ([
275293 '\' {0:s}\' ' .format (doc_file ) for doc_file in doc_files ]),
276294 'description_long' : description_long ,
@@ -284,7 +302,8 @@ def Write(self):
284302 'project_name' : self ._project_definition .name ,
285303 'python2_package_files' : python2_package_files ,
286304 'python3_package_files' : python3_package_files ,
287- 'rpm_doc_files' : ' ' .join (doc_files ),
305+ 'rpm_doc_files' : ' ' .join (rpm_doc_files ),
306+ 'rpm_license_file' : rpm_license_file ,
288307 'scripts_directory' : scripts_directory ,
289308 }
290309
@@ -324,13 +343,13 @@ def Write(self):
324343 'import_sdist' , template_mappings )
325344 file_content .append (template_data )
326345
327- for template_file in ('import_module' , 'bdist_msi' ):
346+ for template_file in ('import_module' , 'bdist_msi' , 'bdist_rpm-start' ):
328347 template_data = self ._GenerateFromTemplate (
329348 template_file , template_mappings )
330349 file_content .append (template_data )
331350
332- if self . _project_definition . name in self . _PROJECTS_WITH_PACKAGE_DATA :
333- template_file = 'bdist_rpm_package_data '
351+ if os . path . isdir ( 'data' ) :
352+ template_file = 'bdist_rpm-with_data '
334353 else :
335354 template_file = 'bdist_rpm'
336355
@@ -369,7 +388,7 @@ def Write(self):
369388
370389 if os .path .isdir ('data' ):
371390 template_data = self ._GenerateFromTemplate (
372- 'setup_data_files_data ' , template_mappings )
391+ 'setup_data_files-with_data ' , template_mappings )
373392 file_content .append (template_data )
374393
375394 template_data = self ._GenerateFromTemplate (
0 commit comments