@@ -63,6 +63,23 @@ def shell_out(cmd):
63
63
raise
64
64
65
65
66
+ def changed_files (directory , other ):
67
+ logging .info ("Computing changed files" )
68
+ changed = []
69
+ if directory [- 1 ] != '/' :
70
+ directory += '/'
71
+ for dirpath , dirnames , filenames in os .walk (directory ):
72
+ dir_rel = dirpath [len (directory ):]
73
+ for fn in filenames :
74
+ local_path = os .path .join (dirpath , fn )
75
+ rel_path = os .path .join (dir_rel , fn )
76
+ target_path = os .path .join (other , rel_path )
77
+ if (os .path .exists (target_path ) and
78
+ not _file_unchanged (target_path , local_path )):
79
+ changed .append (rel_path )
80
+ return changed
81
+
82
+
66
83
def build_one (version , isdev , quick , sphinxbuild , build_root , www_root ,
67
84
skip_cache_invalidation = False , group = 'docs' , git = False ,
68
85
log_directory = '/var/log/docsbuild/' ):
@@ -84,18 +101,7 @@ def build_one(version, isdev, quick, sphinxbuild, build_root, www_root,
84
101
shell_out ("cd Doc; make SPHINXBUILD=%s %s >> %s 2>&1" %
85
102
(sphinxbuild , maketarget , os .path .join (log_directory , logname )))
86
103
87
- logging .info ("Computing changed files" )
88
- changed = []
89
- for dirpath , dirnames , filenames in os .walk ("Doc/build/html/" ):
90
- dir_rel = dirpath [len ("Doc/build/html/" ):]
91
- for fn in filenames :
92
- local_path = os .path .join (dirpath , fn )
93
- rel_path = os .path .join (dir_rel , fn )
94
- target_path = os .path .join (target , rel_path )
95
- if (os .path .exists (target_path ) and
96
- not _file_unchanged (target_path , local_path )):
97
- changed .append (rel_path )
98
-
104
+ changed = changed_files (os .path .join (checkout , "Doc/build/html" ), target )
99
105
logging .info ("Copying HTML files to %s" , target )
100
106
shell_out ("chown -R :{} Doc/build/html/" .format (group ))
101
107
shell_out ("chmod -R o+r Doc/build/html/" )
0 commit comments