File tree 1 file changed +20
-0
lines changed 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,26 @@ def main(_args=None):
299
299
# Support loading modules specified as python paths relative to cwd
300
300
sys .path .append (os .getcwd ())
301
301
302
+ # Virtual Environment Handling for system pdoc cli
303
+ try :
304
+ # this will raise a KeyError if not in a virtual envitonment.
305
+ venvPath = os .environ ['VIRTUAL_ENV' ]
306
+ # pdoc is installed in the current v.e., it will find v.e. local modules.
307
+ if path .isdir (path .join (venvPath ,
308
+ 'lib' ,
309
+ 'site-packages' ,
310
+ 'pdoc' )):
311
+
312
+ pass
313
+ else :
314
+ # pdoc cli is running with system Python context despite being invoked in a v.e.
315
+ sys .path .append (path .join (venvPath ,
316
+ 'lib' ,
317
+ 'site-packages' ))
318
+ except KeyError :
319
+ # pdoc cli was not invoked in a virtual environment
320
+ pass
321
+
302
322
if args .http :
303
323
args .html = True
304
324
args .external_links = True
You can’t perform that action at this time.
0 commit comments