[SERVER-29853] The buildscripts directory should not be a Python package Created: 26/Jun/17  Updated: 06/Dec/22  Resolved: 11/May/20

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Yves Duhem Assignee: Backlog - Server Tooling and Methods (STM) (Inactive)
Resolution: Won't Fix Votes: 0
Labels: stm, tig-resmoke
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Tooling & Methods
Participants:

 Description   

The buildscripts directory is currently a Python package but doesn't need to be and shouldn't be as it makes path management more complicated.
Most of the scripts that are directly under buildscripts/ are executed with commands like python buildscripts/resmoke.py. This requires the PYTHONPATH to be set or the scripts to dynamically update the path but it would no longer be necessary if buildscripts weren't a package.



 Comments   
Comment by Ryan Timmons [ 11/May/20 ]

There is currently an _init_.py file in the buildscripts dir; there is little value in doing anything else.

Comment by Yves Duhem [ 26/Jun/17 ]

Yes, the directory containing the script (buildscripts) would be added to the path and we should be able to reference all other packages and modules from there (like import resmokelib as you mentioned).

Comment by Max Hirschhorn [ 26/Jun/17 ]

This requires the PYTHONPATH to be set or the scripts to dynamically update the path but it would no longer be necessary if buildscripts weren't a package.

yves.duhem, why wouldn't modifying sys.path be necessary if buildscripts wasn't a package? It seems like running python buildscripte/resmoke.py causes the buildscripts/ directory to be added to sys.path. Would we just need to adjust the from buildscripts import resmokelib-style imports to be import resmokelib?

Generated at Thu Feb 08 04:21:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.