本文整理汇总了Python中mozbuild.base.MozbuildObject类的典型用法代码示例。如果您正苦于以下问题:Python MozbuildObject类的具体用法?Python MozbuildObject怎么用?Python MozbuildObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MozbuildObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_symlink_objdir
def test_symlink_objdir(self):
"""Objdir that is a symlink is loaded properly."""
d = os.path.realpath(tempfile.mkdtemp())
try:
topobjdir_real = os.path.join(d, 'objdir')
topobjdir_link = os.path.join(d, 'objlink')
os.mkdir(topobjdir_real)
os.symlink(topobjdir_real, topobjdir_link)
mozconfig = os.path.join(d, 'mozconfig')
with open(mozconfig, 'wt') as fh:
fh.write('mk_add_options MOZ_OBJDIR=%s' % topobjdir_link)
mozinfo = os.path.join(topobjdir_real, 'mozinfo.json')
with open(mozinfo, 'wt') as fh:
json.dump(dict(
topsrcdir=d,
mozconfig=mozconfig,
), fh)
os.chdir(topobjdir_link)
obj = MozbuildObject.from_environment(detect_virtualenv_mozinfo=False)
self.assertEqual(obj.topobjdir, topobjdir_real)
os.chdir(topobjdir_real)
obj = MozbuildObject.from_environment(detect_virtualenv_mozinfo=False)
self.assertEqual(obj.topobjdir, topobjdir_real)
finally:
os.chdir(self._old_cwd)
shutil.rmtree(d)
开发者ID:brendandahl,项目名称:positron,代码行数:32,代码来源:test_base.py
示例2: test_objdir_mismatch
def test_objdir_mismatch(self):
"""Ensure MachCommandBase throwing on objdir mismatch."""
d = os.path.realpath(tempfile.mkdtemp())
try:
real_topobjdir = os.path.join(d, 'real-objdir')
os.makedirs(real_topobjdir)
topobjdir = os.path.join(d, 'objdir')
os.makedirs(topobjdir)
topsrcdir = os.path.join(d, 'srcdir')
os.makedirs(topsrcdir)
mozconfig = os.path.join(d, 'mozconfig')
with open(mozconfig, 'wt') as fh:
fh.write('mk_add_options MOZ_OBJDIR=%s' % real_topobjdir)
mozinfo = os.path.join(topobjdir, 'mozinfo.json')
with open(mozinfo, 'wt') as fh:
json.dump(dict(
topsrcdir=topsrcdir,
mozconfig=mozconfig,
), fh)
os.chdir(topobjdir)
with self.assertRaises(ObjdirMismatchException):
MozbuildObject.from_environment(detect_virtualenv_mozinfo=False)
finally:
os.chdir(self._old_cwd)
shutil.rmtree(d)
开发者ID:brendandahl,项目名称:positron,代码行数:33,代码来源:test_base.py
示例3: __init__
def __init__(self, *args, **kwargs):
MozbuildObject.__init__(self, *args, **kwargs)
# TODO Bug 794506 remove once mach integrates with virtualenv.
build_path = os.path.join(self.topobjdir, 'build')
if build_path not in sys.path:
sys.path.append(build_path)
self.tests_dir = os.path.join(self.topobjdir, '_tests')
self.reftest_dir = os.path.join(self.tests_dir, 'reftest')
开发者ID:nightahul,项目名称:gecko-dev,代码行数:10,代码来源:mach_commands.py
示例4: _get_resolver
def _get_resolver(self):
topobjdir = tempfile.mkdtemp()
self._temp_dirs.append(topobjdir)
with open(os.path.join(topobjdir, "all-tests.json"), "wt") as fh:
fh.write(ALL_TESTS_JSON)
o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir)
return o._spawn(TestResolver)
开发者ID:jpetrell,项目名称:gecko-dev,代码行数:10,代码来源:test_testing.py
示例5: _get_resolver
def _get_resolver(self):
topobjdir = tempfile.mkdtemp()
self._temp_dirs.append(topobjdir)
with open(os.path.join(topobjdir, 'all-tests.json'), 'wt') as fh:
fh.write(ALL_TESTS_JSON)
o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir)
# Monkey patch the test resolver to avoid tests failing to find make
# due to our fake topscrdir.
TestResolver._run_make = lambda *a, **b: None
return o._spawn(TestResolver)
开发者ID:MekliCZ,项目名称:positron,代码行数:14,代码来源:test_testing.py
示例6: test_recursive_make
def test_recursive_make(self):
substs = list(BASE_SUBSTS)
with self.do_test_backend(RecursiveMakeBackend,
substs=substs) as config:
build = MozbuildObject(config.topsrcdir, None, None,
config.topobjdir)
overrides = [
'install_manifest_depends=',
'TEST_MOZBUILD=1',
]
with self.line_handler() as handle_make_line:
build._run_make(directory=config.topobjdir, target=overrides,
silent=False, line_handler=handle_make_line)
self.validate(config)
开发者ID:stefanie-cliqz,项目名称:browser-f,代码行数:15,代码来源:test_build.py
示例7: __init__
def __init__(self, *args, **kwargs):
MozbuildObject.__init__(self, *args, **kwargs)
# TODO Bug 794506 remove once mach integrates with virtualenv.
build_path = os.path.join(self.topobjdir, 'build')
if build_path not in sys.path:
sys.path.append(build_path)
build_path = os.path.join(self.topsrcdir, 'build')
if build_path not in sys.path:
sys.path.append(build_path)
self.tests_dir = os.path.join(self.topobjdir, '_tests')
self.xpcshell_dir = os.path.join(self.tests_dir, 'xpcshell')
self.bin_dir = os.path.join(self.distdir, 'bin')
开发者ID:html-shell,项目名称:mozbuild,代码行数:15,代码来源:mach_commands.py
示例8: _get_resolver
def _get_resolver(self):
topobjdir = tempfile.mkdtemp()
self._temp_dirs.append(topobjdir)
with open(os.path.join(topobjdir, 'all-tests.pkl'), 'wb') as fh:
pickle.dump(ALL_TESTS, fh)
with open(os.path.join(topobjdir, 'test-defaults.pkl'), 'wb') as fh:
pickle.dump(TEST_DEFAULTS, fh)
o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir)
# Monkey patch the test resolver to avoid tests failing to find make
# due to our fake topscrdir.
TestResolver._run_make = lambda *a, **b: None
return o._spawn(TestResolver)
开发者ID:luke-chang,项目名称:gecko-1,代码行数:16,代码来源:test_resolve.py
示例9: find_and_update_from_json
def find_and_update_from_json(*dirs):
"""
Find a mozinfo.json file, load it, and update the info with the
contents.
:param dirs: Directories in which to look for the file. They will be
searched after first looking in the root of the objdir
if the current script is being run from a Mozilla objdir.
Returns the full path to mozinfo.json if it was found, or None otherwise.
"""
# First, see if we're in an objdir
try:
from mozbuild.base import MozbuildObject, BuildEnvironmentNotFoundException
from mozbuild.mozconfig import MozconfigFindException
build = MozbuildObject.from_environment()
json_path = _os.path.join(build.topobjdir, "mozinfo.json")
if _os.path.isfile(json_path):
update(json_path)
return json_path
except ImportError:
pass
except (BuildEnvironmentNotFoundException, MozconfigFindException):
pass
for d in dirs:
d = _os.path.abspath(d)
json_path = _os.path.join(d, "mozinfo.json")
if _os.path.isfile(json_path):
update(json_path)
return json_path
return None
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:33,代码来源:mozinfo.py
示例10: test_relative_objdir
def test_relative_objdir(self):
"""Relative defined objdirs are loaded properly."""
d = os.path.realpath(tempfile.mkdtemp())
try:
mozconfig = os.path.join(d, 'mozconfig')
with open(mozconfig, 'wt') as fh:
fh.write('mk_add_options MOZ_OBJDIR=./objdir')
topobjdir = mozpath.join(d, 'objdir')
os.mkdir(topobjdir)
mozinfo = os.path.join(topobjdir, 'mozinfo.json')
with open(mozinfo, 'wt') as fh:
json.dump(dict(
topsrcdir=d,
mozconfig=mozconfig,
), fh)
os.environ[b'MOZCONFIG'] = mozconfig.encode('utf-8')
child = os.path.join(topobjdir, 'foo', 'bar')
os.makedirs(child)
os.chdir(child)
obj = MozbuildObject.from_environment(
detect_virtualenv_mozinfo=False)
self.assertEqual(obj.topobjdir, topobjdir)
finally:
os.chdir(self._old_cwd)
shutil.rmtree(d)
开发者ID:brendandahl,项目名称:positron,代码行数:31,代码来源:test_base.py
示例11: get_properties_db_from_xpcshell
def get_properties_db_from_xpcshell(self):
"""Generate the static css properties db for devtools from an xpcshell script."""
build = MozbuildObject.from_environment()
# Get the paths
script_path = resolve_path(self.topsrcdir,
'devtools/shared/css/generated/generate-properties-db.js')
gre_path = resolve_path(self.topobjdir, 'dist/bin')
browser_path = resolve_path(self.topobjdir, 'dist/bin/browser')
xpcshell_path = build.get_binary_path(what='xpcshell')
print(browser_path)
sub_env = dict(os.environ)
if sys.platform.startswith('linux'):
sub_env["LD_LIBRARY_PATH"] = gre_path
# Run the xcpshell script, and set the appdir flag to the browser path so that
# we have the proper dependencies for requiring the loader.
contents = subprocess.check_output([xpcshell_path, '-g', gre_path,
'-a', browser_path, script_path],
env = sub_env)
# Extract just the output between the delimiters as the xpcshell output can
# have extra output that we don't want.
contents = contents.split('DEVTOOLS_CSS_DB_DELIMITER')[1]
return json.loads(contents)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:26,代码来源:mach_commands.py
示例12: mozregression_create_parser
def mozregression_create_parser():
# Create the mozregression command line parser.
# if mozregression is not installed, or not up to date, it will
# first be installed.
cmd = MozbuildObject.from_environment()
cmd._activate_virtualenv()
mozregression = mozregression_import()
if not mozregression:
# mozregression is not here at all, install it
cmd.virtualenv_manager.install_pip_package('mozregression')
print("mozregression was installed. please re-run your"
" command. If you keep getting this message please "
" manually run: 'pip install -U mozregression'.")
else:
# check if there is a new release available
release = mozregression.new_release_on_pypi()
if release:
print(release)
# there is one, so install it. Note that install_pip_package
# does not work here, so just run pip directly.
cmd.virtualenv_manager._run_pip([
'install',
'mozregression==%s' % release
])
print("mozregression was updated to version %s. please"
" re-run your command." % release)
else:
# mozregression is up to date, return the parser.
return mozregression.parser()
# exit if we updated or installed mozregression because
# we may have already imported mozregression and running it
# as this may cause issues.
sys.exit(0)
开发者ID:brendandahl,项目名称:positron,代码行数:33,代码来源:mach_commands.py
示例13: get_parser
def get_parser():
here = os.path.abspath(os.path.dirname(__file__))
build_obj = MozbuildObject.from_environment(cwd=here)
if conditions.is_android(build_obj):
return reftestcommandline.RemoteArgumentsParser()
else:
return reftestcommandline.DesktopArgumentsParser()
开发者ID:psvramaraju,项目名称:gecko-dev,代码行数:7,代码来源:mach_commands.py
示例14: main
def main(platform):
build = MozbuildObject.from_environment()
topsrcdir = build.topsrcdir
distdir = build.distdir
srcdir = os.path.join(topsrcdir, "b2g", "simulator")
app_buildid = open(os.path.join(build.topobjdir, "config", "buildid")).read().strip()
# The simulator uses a shorter version string,
# it only keeps the major version digits A.B
# whereas MOZ_B2G_VERSION is A.B.C.D
b2g_version = build.config_environment.defines["MOZ_B2G_VERSION"].replace('"', '')
version = ".".join(str(n) for n in LooseVersion(b2g_version).version[0:2])
# Build a gaia profile specific to the simulator in order to:
# - disable the FTU
# - set custom prefs to enable devtools debugger server
# - set custom settings to disable lockscreen and screen timeout
# - only ship production apps
gaia_path = build.config_environment.substs["GAIADIR"]
builder = GaiaBuilder(build, gaia_path)
builder.clean()
env = {
"NOFTU": "1",
"GAIA_APP_TARGET": "production",
"SETTINGS_PATH": os.path.join(srcdir, "custom-settings.json")
}
builder.profile(env)
builder.override_prefs(os.path.join(srcdir, "custom-prefs.js"))
# Substitute version strings in the package manifest overload file
manifest_overload = os.path.join(build.topobjdir, "b2g", "simulator", "package-overload.json")
process_package_overload(os.path.join(srcdir, "package-overload.json.in"),
manifest_overload,
version,
app_buildid)
# Build the simulator addon xpi
xpi_name = XPI_NAME % {"version": version, "platform": platform}
xpi_path = os.path.join(distdir, xpi_name)
update_path = "%s/%s" % (version, platform)
update_link = UPDATE_LINK % {"update_path": update_path, "xpi_name": xpi_name}
update_url = UPDATE_URL % {"update_path": update_path}
subprocess.check_call([
build.virtualenv_manager.python_path, os.path.join(topsrcdir, "addon-sdk", "source", "bin", "cfx"), "xpi", \
"--pkgdir", srcdir, \
"--manifest-overload", manifest_overload, \
"--strip-sdk", \
"--update-link", update_link, \
"--update-url", update_url, \
"--static-args", "{\"label\": \"Firefox OS %s\"}" % version, \
"--output-file", xpi_path \
])
# Ship b2g-desktop, but prevent its gaia profile to be shipped in the xpi
add_dir_to_zip(xpi_path, os.path.join(distdir, "b2g"), "b2g", ("gaia", "B2G.app/Contents/MacOS/gaia"))
# Then ship our own gaia profile
add_dir_to_zip(xpi_path, os.path.join(gaia_path, "profile"), "profile")
开发者ID:PatMart,项目名称:gecko-dev,代码行数:60,代码来源:build_xpi.py
示例15: get_parser
def get_parser():
build_obj = MozbuildObject.from_environment(cwd=here)
if conditions.is_android(build_obj):
return parser_remote()
elif conditions.is_b2g(build_obj):
return parser_b2g()
else:
return parser_desktop()
开发者ID:npark-mozilla,项目名称:gecko-dev,代码行数:8,代码来源:mach_commands.py
示例16: test_objdir_is_srcdir_rejected
def test_objdir_is_srcdir_rejected(self):
"""Ensure the srcdir configurations are rejected."""
d = os.path.realpath(tempfile.mkdtemp())
try:
# The easiest way to do this is to create a mozinfo.json with data
# that will never happen.
mozinfo = os.path.join(d, 'mozinfo.json')
with open(mozinfo, 'wt') as fh:
json.dump({'topsrcdir': d}, fh)
os.chdir(d)
with self.assertRaises(BadEnvironmentException):
MozbuildObject.from_environment(detect_virtualenv_mozinfo=False)
finally:
shutil.rmtree(d)
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:18,代码来源:test_base.py
示例17: _init
def _init(self):
CommonBackend._init(self)
self._backend_files = {}
self._cmd = MozbuildObject.from_environment()
# This is a 'group' dependency - All rules that list this as an output
# will be built before any rules that list this as an input.
self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
开发者ID:ollie314,项目名称:gecko-dev,代码行数:9,代码来源:tup.py
示例18: test_info
def test_info(self, **params):
import which
from mozbuild.base import MozbuildObject
self.branches = params['branches']
self.start = params['start']
self.end = params['end']
self.show_info = params['show_info']
self.show_results = params['show_results']
self.show_durations = params['show_durations']
self.show_bugs = params['show_bugs']
self.verbose = params['verbose']
if (not self.show_info and
not self.show_results and
not self.show_durations and
not self.show_bugs):
# by default, show everything
self.show_info = True
self.show_results = True
self.show_durations = True
self.show_bugs = True
here = os.path.abspath(os.path.dirname(__file__))
build_obj = MozbuildObject.from_environment(cwd=here)
self._hg = None
if conditions.is_hg(build_obj):
if self._is_windows():
self._hg = which.which('hg.exe')
else:
self._hg = which.which('hg')
self._git = None
if conditions.is_git(build_obj):
if self._is_windows():
self._git = which.which('git.exe')
else:
self._git = which.which('git')
for test_name in params['test_names']:
print("===== %s =====" % test_name)
self.test_name = test_name
if len(self.test_name) < 6:
print("'%s' is too short for a test name!" % self.test_name)
continue
if self.show_info:
self.set_test_name()
if self.show_results:
self.report_test_results()
if self.show_durations:
self.report_test_durations()
if self.show_bugs:
self.report_bugs()
开发者ID:luke-chang,项目名称:gecko-1,代码行数:55,代码来源:mach_commands.py
示例19: make_dmg
def make_dmg(source_directory, output_dmg):
build = MozbuildObject.from_environment()
extra_files = [
(os.path.join(build.distdir, 'branding', 'dsstore'), '.DS_Store'),
(os.path.join(build.distdir, 'branding', 'background.png'),
'.background/background.png'),
(os.path.join(build.distdir, 'branding', 'disk.icns'),
'.VolumeIcon.icns'),
]
volume_name = build.substs['MOZ_APP_DISPLAYNAME']
dmg.create_dmg(source_directory, output_dmg, volume_name, extra_files)
开发者ID:MekliCZ,项目名称:positron,代码行数:11,代码来源:make_dmg.py
示例20: main
def main(platform):
build = MozbuildObject.from_environment()
topsrcdir = build.topsrcdir
distdir = build.distdir
srcdir = os.path.join(topsrcdir, "b2g", "simulator")
app_buildid = open(os.path.join(build.topobjdir, "config", "buildid")).read().strip()
# The simulator uses a shorter version string,
# it only keeps the major version digits A.B
# whereas MOZ_B2G_VERSION is A.B.C.D
b2g_version = build.config_environment.defines["MOZ_B2G_VERSION"].replace('"', "")
version = ".".join(str(n) for n in LooseVersion(b2g_version).version[0:2])
# Build a gaia profile specific to the simulator in order to:
# - disable the FTU
# - set custom prefs to enable devtools debugger server
# - set custom settings to disable lockscreen and screen timeout
# - only ship production apps
gaia_path = build.config_environment.substs["GAIADIR"]
builder = GaiaBuilder(build, gaia_path)
builder.clean()
env = {"NOFTU": "1", "GAIA_APP_TARGET": "production", "SETTINGS_PATH": os.path.join(srcdir, "custom-settings.json")}
builder.profile(env)
builder.override_prefs(os.path.join(srcdir, "custom-prefs.js"))
# Build the simulator addon xpi
xpi_name = XPI_NAME % {"version": version, "platform": platform}
xpi_path = os.path.join(distdir, xpi_name)
update_path = "%s/%s" % (version, platform)
update_url = UPDATE_URL % {"update_path": update_path}
# Preprocess some files...
manifest = os.path.join(build.topobjdir, "b2g", "simulator", "install.rdf")
preprocess_file(os.path.join(srcdir, "install.rdf.in"), manifest, version, app_buildid, update_url)
with JarWriter(xpi_path, optimize=False) as zip:
# Ship addon files into the .xpi
add_file_to_zip(zip, manifest, "install.rdf")
add_file_to_zip(zip, os.path.join(srcdir, "bootstrap.js"), "bootstrap.js")
add_file_to_zip(zip, os.path.join(srcdir, "icon.png"), "icon.png")
add_file_to_zip(zip, os.path.join(srcdir, "icon64.png"), "icon64.png")
# Ship b2g-desktop, but prevent its gaia profile to be shipped in the xpi
add_dir_to_zip(
zip,
os.path.join(distdir, "b2g"),
"b2g",
("gaia", "B2G.app/Contents/MacOS/gaia", "B2G.app/Contents/Resources/gaia"),
)
# Then ship our own gaia profile
add_dir_to_zip(zip, os.path.join(gaia_path, "profile"), "profile")
开发者ID:carriercomm,项目名称:gecko-dev,代码行数:54,代码来源:build_xpi.py
注:本文中的mozbuild.base.MozbuildObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论