@@ -136,25 +136,28 @@ def push_cached_environment(self):
136
136
return
137
137
138
138
project_path = self .project .doc_path
139
- paths = [
140
- os .path .join (project_path , 'checkouts' , self .version .slug ),
141
- os .path .join (project_path , 'envs' , self .version .slug ),
142
- os .path .join (project_path , 'conda' , self .version .slug ),
143
- os .path .join (project_path , '.cache' ),
139
+ directories = [
140
+ 'checkouts' ,
141
+ 'envs' ,
142
+ 'conda' ,
144
143
]
145
144
146
145
_ , tmp_filename = tempfile .mkstemp (suffix = '.tar' )
147
146
# open just with 'w', to not compress and waste CPU cycles
148
147
with tarfile .open (tmp_filename , 'w' ) as tar :
149
- for path in paths :
148
+ for directory in directories :
149
+ path = os .path .join (
150
+ project_path ,
151
+ directory ,
152
+ self .version .slug ,
153
+ )
154
+ arcname = os .path .join (directory , self .version .slug )
150
155
if os .path .exists (path ):
151
- tar .add (
152
- path ,
153
- arcname = os .path .join (
154
- os .path .basename (os .path .dirname (path )),
155
- self .version .slug ,
156
- )
157
- )
156
+ tar .add (path , arcname = arcname )
157
+
158
+ # Special handling for .cache directory because it's per-project
159
+ path = os .path .join (project_path , '.cache' )
160
+ tar .add (path , arcname = '.cache' )
158
161
159
162
storage = get_storage_class (settings .RTD_BUILD_ENVIRONMENT_STORAGE )()
160
163
with open (tmp_filename , 'rb' ) as fd :
0 commit comments