mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 907552 - Add ability to specify cwd to MozbuildObject.from_environment(), r=gps
This commit is contained in:
parent
b4b181eaf0
commit
6aa2be2268
@ -87,7 +87,7 @@ class MozbuildObject(ProcessExecutionMixin):
|
||||
self._config_environment = None
|
||||
|
||||
@classmethod
|
||||
def from_environment(cls):
|
||||
def from_environment(cls, cwd=None):
|
||||
"""Create a MozbuildObject by detecting the proper one from the env.
|
||||
|
||||
This examines environment state like the current working directory and
|
||||
@ -111,6 +111,7 @@ class MozbuildObject(ProcessExecutionMixin):
|
||||
If we're not inside a srcdir or objdir, an exception is raised.
|
||||
"""
|
||||
|
||||
cwd = cwd or os.getcwd()
|
||||
topsrcdir = None
|
||||
topobjdir = None
|
||||
mozconfig = None
|
||||
@ -122,7 +123,7 @@ class MozbuildObject(ProcessExecutionMixin):
|
||||
mozconfig = info.get('mozconfig')
|
||||
return topsrcdir, topobjdir, mozconfig
|
||||
|
||||
for dir_path in ancestors(os.getcwd()):
|
||||
for dir_path in ancestors(cwd):
|
||||
# If we find a mozinfo.json, we are in the objdir.
|
||||
mozinfo_path = os.path.join(dir_path, 'mozinfo.json')
|
||||
if os.path.isfile(mozinfo_path):
|
||||
|
@ -12,14 +12,14 @@ from automationutils import addCommonOptions, isURL
|
||||
from mozprofile import DEFAULT_PORTS
|
||||
import moznetwork
|
||||
|
||||
here = os.path.abspath(os.path.dirname(sys.argv[0]))
|
||||
|
||||
try:
|
||||
from mozbuild.base import MozbuildObject
|
||||
build_obj = MozbuildObject.from_environment()
|
||||
build_obj = MozbuildObject.from_environment(cwd=here)
|
||||
except ImportError:
|
||||
build_obj = None
|
||||
|
||||
here = os.path.abspath(os.path.dirname(sys.argv[0]))
|
||||
|
||||
__all__ = ["MochitestOptions", "B2GOptions"]
|
||||
|
||||
VMWARE_RECORDING_HELPER_BASENAME = "vmwarerecordinghelper"
|
||||
|
Loading…
Reference in New Issue
Block a user