@@ -290,12 +290,29 @@ def setup_environment(version):
290
290
)
291
291
)
292
292
293
- if project .requirements_file :
294
- os .chdir (project .checkout_path (version .slug ))
293
+ # Handle requirements
294
+
295
+ requirements_file_path = project .requirements_file
296
+ if not requirements_file_path :
297
+ docs_dir = builder_loading .get (project .documentation_type )(version ).docs_dir ()
298
+ checkout_path = project .checkout_path (version .slug )
299
+ for path in [docs_dir , '' ]:
300
+ for req_file in ['pip_requirements.txt' , 'requirements.txt' ]:
301
+ test_path = os .path .join (checkout_path , path , req_file )
302
+ print ('Testing %s' % test_path )
303
+ if os .path .exists (test_path ):
304
+ requirements_file_path = test_path
305
+ break
306
+
307
+ if requirements_file_path :
308
+ os .chdir (checkout_path )
295
309
ret_dict ['requirements' ] = run (
296
310
'{cmd} install --exists-action=w -r {requirements}' .format (
297
311
cmd = project .venv_bin (version = version .slug , bin = 'pip' ),
298
- requirements = project .requirements_file ))
312
+ requirements = requirements_file_path ))
313
+
314
+ # Handle setup.py
315
+
299
316
os .chdir (project .checkout_path (version .slug ))
300
317
if os .path .isfile ("setup.py" ):
301
318
if getattr (settings , 'USE_PIP_INSTALL' , False ):
@@ -321,7 +338,6 @@ def build_docs(version, force, pdf, man, epub, dash, search, localmedia):
321
338
project = version .project
322
339
results = {}
323
340
324
-
325
341
with project .repo_nonblockinglock (version = version ,
326
342
max_lock_age = getattr (settings , 'REPO_LOCK_SECONDS' , 30 )):
327
343
html_builder = builder_loading .get (project .documentation_type )(version )
0 commit comments