@@ -131,6 +131,8 @@ class install(Command):
131
131
132
132
('record=' , None ,
133
133
"filename in which to record list of installed files" ),
134
+ ('record-rpm=' , None ,
135
+ "filename in which to record list of installed files and directories suitable as filelist for rpm" ),
134
136
]
135
137
136
138
boolean_options = ['compile' , 'force' , 'skip-build' ]
@@ -213,6 +215,7 @@ def initialize_options(self):
213
215
#self.install_info = None
214
216
215
217
self .record = None
218
+ self .record_rpm = None
216
219
217
220
218
221
# -- Option finalizing methods -------------------------------------
@@ -560,12 +563,61 @@ def run(self):
560
563
self .create_path_file ()
561
564
562
565
# write list of installed files, if requested.
563
- if self .record :
566
+ if self .record or self . record_rpm :
564
567
outputs = self .get_outputs ()
565
568
if self .root : # strip any package prefix
566
569
root_len = len (self .root )
567
570
for counter in range (len (outputs )):
568
571
outputs [counter ] = outputs [counter ][root_len :]
572
+ if self .record_rpm : # add directories
573
+ self .record = self .record_rpm
574
+ dirs = []
575
+ # directories to reject:
576
+ rejectdirs = [
577
+ '/etc' ,
578
+ '/' ,
579
+ '' ,
580
+ self .prefix ,
581
+ self .exec_prefix ,
582
+ self .install_base ,
583
+ self .install_platbase ,
584
+ self .install_purelib ,
585
+ self .install_platlib ,
586
+ self .install_headers [:len (self .install_headers ) - len (self .distribution .get_name ()) - 1 ],
587
+ self .install_libbase ,
588
+ self .install_scripts ,
589
+ self .install_data ,
590
+ os .path .join (self .install_data , 'share' ),
591
+ os .path .join (self .install_data , 'share' , 'doc' ),
592
+ ]
593
+ # directories whose childs reject:
594
+ rejectdirs2 = [
595
+ os .path .join (self .install_data , 'share' , 'man' ),
596
+ ]
597
+ # directories whose grandsons reject:
598
+ rejectdirs3 = [
599
+ os .path .join (self .install_data , 'share' , 'man' ),
600
+ os .path .join (self .install_data , 'share' , 'locale' ),
601
+ ]
602
+ for counter in range (len (rejectdirs )):
603
+ if len (rejectdirs [counter ]) > root_len :
604
+ rejectdirs [counter ] = rejectdirs [counter ][root_len :]
605
+ for counter in range (len (rejectdirs2 )):
606
+ if len (rejectdirs2 [counter ]) > root_len :
607
+ rejectdirs2 [counter ] = rejectdirs2 [counter ][root_len :]
608
+ for counter in range (len (rejectdirs3 )):
609
+ if len (rejectdirs3 [counter ]) > root_len :
610
+ rejectdirs3 [counter ] = rejectdirs3 [counter ][root_len :]
611
+ for counter in range (len (outputs )):
612
+ directory = os .path .dirname (outputs [counter ])
613
+ while directory not in rejectdirs and \
614
+ os .path .dirname (directory ) not in rejectdirs2 and \
615
+ os .path .dirname (os .path .dirname (directory )) not in rejectdirs3 :
616
+ dirname = '%dir ' + directory
617
+ if dirname not in dirs :
618
+ dirs .append (dirname )
619
+ directory = os .path .dirname (directory )
620
+ outputs += dirs
569
621
self .execute (write_file ,
570
622
(self .record , outputs ),
571
623
"writing list of installed files to '%s'" %
0 commit comments