rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
import pyglet import cocos from cocos import tiles from cocos.director import director
def edit_complete(self, layer): pyglet.app.exit()
director.show_FPS = True
def edit_complete(self, layer): pyglet.app.exit()
pos_y = (height - (idx * fo_height )
pos_y = (height - ((idx + 0.8) * fo_height )
def verticalMenuLayout (menu): width, height = director.get_window_size() fo = font.load(menu.font_item['font_name'], menu.font_item['font_size']) fo_height = int( (fo.ascent - fo.descent) * 0.9 ) if menu.menu_halign == CENTER: pos_x = width // 2 elif menu.menu_halign == RIGHT: pos_x = width - menu.menu_hmargin elif m...
if self.rotation != 0.0: glRotatef( -self.rotation, 0, 0, 1)
def transform( self ): """ Apply ModelView transformations you will most likely want to wrap calls to this function with glPushMatrix/glPopMatrix """ x,y = director.get_window_size()
for tag in tag.findall('./property'): name = tag.get('name') type = tag.get('type') or 'unicode' value = tag.get('value')
for node in tag.findall('./property'): name = node.get('name') type = node.get('type') or 'unicode' value = node.get('value') if name is None: raise TilesPropertyWithoutName("\nnode:\n%s"%ElementTree.tostring(node)) if value is None: raise TilesPropertyWithoutValue("\nnode:\n%s"%ElementTree.tostring(node))
def _handle_properties(tag): properties = {} for tag in tag.findall('./property'): name = tag.get('name') type = tag.get('type') or 'unicode' value = tag.get('value') properties[name] = _xml_to_python[type](value) return properties
properties = properties or {}
self.properties = properties or {}
def __init__(self, id, tw, th, cells, origin=None, properties=None): properties = properties or {} self.id = id self.tw, self.th = tw, th if origin is None: origin = (0, 0, 0) self.origin_x, self.origin_y, self.origin_z = origin self.cells = cells self.px_width = len(cells) * tw self.px_height = len(cells[0]) * th
screensprite.do(zoom)
def start(self): screensprite = self._create_out_screenshot()
self.in_scene.do(Delay(self.duration * 2) + restore)
screensprite.do(zoom + restore)
def start(self): screensprite = self._create_out_screenshot()
return SDL.array.SDL_array(self._abuf, self.alen, c_ubyte) raise AttributeException, attr
return array.SDL_array(self._abuf, self.alen, c_ubyte) raise AttributeError, attr
def __getattr__(self, attr): if attr == 'abuf': return SDL.array.SDL_array(self._abuf, self.alen, c_ubyte) raise AttributeException, attr
arg_types=[POINTER(SDL.rwops.SDL_RWops), c_int],
arg_types=[POINTER(rwops.SDL_RWops), c_int],
def Mix_QuerySpec(): '''Find out what the actual audio device parameters are. The function returns a tuple giving each parameter value. The first value is 1 if the audio has been opened, 0 otherwise. :rtype: (int, int, int, int) :return: (opened, frequency, format, channels) ''' frequency, format, channels = c_int()...
return Mix_LoadWAV_RW(SDL.rwops.SDL_RWFromFile(file, 'rb'), 1)
return Mix_LoadWAV_RW(rwops.SDL_RWFromFile(file, 'rb'), 1)
def Mix_LoadWAV(file): '''Load a WAV, RIFF, AIFF, OGG or VOC file. :Parameters: `file` : string Filename to load. :rtype: `Mix_Chunk` ''' return Mix_LoadWAV_RW(SDL.rwops.SDL_RWFromFile(file, 'rb'), 1)
ref, mem = SDL.array.to_ctypes(mem, len(mem), c_ubyte)
ref, mem = array.to_ctypes(mem, len(mem), c_ubyte)
def Mix_QuickLoad_WAV(mem): '''Load a wave file of the mixer format from a sequence or SDL_array. :Parameters: - `mem`: sequence or `SDL_array` :rtype: `Mix_Chunk` ''' ref, mem = SDL.array.to_ctypes(mem, len(mem), c_ubyte) return _Mix_QuickLoad_WAV(mem)
stream = SDL.array.SDL_array(stream, len, c_ubyte)
stream = array.SDL_array(stream, len, c_ubyte)
def f(ignored, stream, len): # FIXME: getting a negative len value here sometimes if len < 0: return stream = SDL.array.SDL_array(stream, len, c_ubyte) func(udata, stream)
stream = SDL.array.SDL_array(stream, len, c_ubyte)
stream = array.SDL_array(stream, len, c_ubyte)
def f(chan, stream, len, ignored): stream = SDL.array.SDL_array(stream, len, c_ubyte) func(chan, stream, udata)
if self.current_action.done(): self._next_action()
def start(self): self.one.target = self.target self.two.target = self.target self.current_action = self.one self.current_action.start() if self.current_action.done(): self._next_action()
cls = Spawn_IntervalAction
cls = Spawn_Action
def spawn(action_1, action_2): """Returns an action that runs action_1 and action_2 in paralel. The returned action will be instance of the most narrow class posible in InstantAction, IntervalAction, Action """ if (isinstance(action_1,InstantAction) and isinstance(action_2, InstantAction)): cls = Spawn_InstantAction if...
def update(self, t):
def start(self):
def update(self, t): if self.target.grid and self.target.grid.active: self.target.grid.active = False
raise cocos.audio.SDL.error.SDL_Exception, SDL.error.SDL_GetError()
raise cocos.audio.SDL.error.SDL_Exception, cocos.audio.SDL.error.SDL_GetError()
def _f(*args, **kwargs): result = func(*args, **kwargs) if result: return result.contents import cocos.audio.SDL.error raise cocos.audio.SDL.error.SDL_Exception, SDL.error.SDL_GetError()
raise cocos.audio.SDL.error.SDL_Exception, SDL.error.SDL_GetError()
raise cocos.audio.SDL.error.SDL_Exception, cocos.audio.SDL.error.SDL_GetError()
def _f(*args, **kwargs): result = func(*args, **kwargs) if result != success_return: import cocos.audio.SDL.error raise cocos.audio.SDL.error.SDL_Exception, SDL.error.SDL_GetError() return result
raise cocos.audio.SDL.error.SDL_Exception, SDL.error.SDL_GetError()
raise cocos.audio.SDL.error.SDL_Exception, cocus.audio.SDL.error.SDL_GetError()
def _f(*args, **kwargs): result = func(*args, **kwargs) if result == error_return: import cocos.audio.SDL.error raise cocos.audio.SDL.error.SDL_Exception, SDL.error.SDL_GetError() return result
raise cocos.audio.SDL.error.SDL_Exception, SDL.error.SDL_GetError()
raise cocos.audio.SDL.error.SDL_Exception, cocos.audio.SDL.error.SDL_GetError()
def _f(*args, **kwargs): result = func(*args, **kwargs) if not result: import cocos.audio.SDL.error raise cocos.audio.SDL.error.SDL_Exception, SDL.error.SDL_GetError() return result
self._load_library_nix()
self._load_library_nix(version)
def __init__(self, library_name, version_function_name, version=None): self.library_name = library_name if sys.platform=='win32': try: self._load_library_win() except WindowsError: raise ImportError, ('Dynamic library "%s" was not found' % library_name) else: self._load_library_nix()
def _load_library_nix(self):
def _load_library_nix(self, version):
def _load_library_nix(self): library = find_library(self.library_name) if library is None and version is not None: # try to lookup with version. this is useful in linux, sometimes # there is'nt a libSDL.so but a libSDL-1.2.so library = find_library("%s-%s" % (self.library_name, version)) if not library: raise ImportErr...
self.add_particle()
def on_enter( self ): super( ParticleSystem, self).on_enter() self.add_particle()
return Loop( Reverse(self.one), self.times )
return Loop_IntervalAction( Reverse(self.one), self.times )
def __reversed__(self): return Loop( Reverse(self.one), self.times )
self.fps_display.label.delete()
def set_show_FPS(self, value): if value and self.fps_display is None: self.fps_display = clock.ClockDisplay() elif not value and self.fps_display is not None: self.fps_display.unschedule() self.fps_display.label.delete() self.fps_display = None
main_scene.do( flip + ReverseTime(flip) )
main_scene.do( flip + Reverse(flip) )
def draw( self ): self.img.blit(0,0)
def ReleaseToTryserverBuilds(options, upload_dir, files): tryserverBuildsPath = TRYSERVER_DIR % {'who': options.who, 'revision': options.revision, 'builddir': options.builddir} tryserverBuildsUrl = TRYSERVER_URL_PATH % {'who': options.who, 'revision': options.revision, 'builddir': options.builddir} for f in files: Copy...
def ReleaseToCandidatesDir(options, upload_dir, files): candidatesDir = CANDIDATES_DIR % {'version': options.version, 'buildnumber': options.build_number} candidatesPath = os.path.join(NIGHTLY_PATH, candidatesDir) candidatesUrl = CANDIDATES_URL_PATH % { 'nightly_dir': options.nightly_dir, 'version': options.version, 'b...
elif 'win' in slavename:
elif 'win' in slavename or 'w32' in slavename:
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'slave' in slavename: buildmaster_host = BUILD_BUILDMASTER if 'linux' in slavename or 'darwin' in slavename: basedir = '/builds/slave' elif 'win' in sl...
parser.set_defaults(size=5, skip=[], dry_run=False, max_age=28)
parser.set_defaults(size=5, skip=[], dry_run=False, max_age=14)
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age. Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir...
slavename.startswith('win32') or slavename.startswith('w32'):
slavename.startswith('win32') or slavename.startswith('mw32'):
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('w32'): if 'try-' in sla...
elif 'win32' in slavename or 'w32' in slavename:
elif 'win32' in slavename or 'mw32' in slavename:
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('w32'): if 'try-' in sla...
def run_with_timeout(cmd, timeout): proc = subprocess.Popen(cmd)
def search_output(f, regexp, fail_if_match): f.seek(0) res = re.search(regexp, f.read()) return xor(bool(res), fail_if_match) def run_with_timeout(cmd, timeout, stdout_regexp=None, stderr_regexp=None, fail_if_match=False): stdout = TemporaryFile() stderr = TemporaryFile() proc = subprocess.Popen(cmd, stdout=stdout, st...
def run_with_timeout(cmd, timeout): proc = subprocess.Popen(cmd) start_time = time.time() log.info("Executing: %s", cmd) while True: rc = proc.poll() if rc is not None: log.debug("Process returned %s", rc) return rc == 0 if start_time + timeout < time.time(): log.warn("WARNING: Timeout (%i) exceeded, killing process %...
return rc == 0
if rc == 0: ret = True if stdout_regexp and not \ search_output(stdout, stdout_regexp, fail_if_match): ret = False if stderr_regexp and not \ search_output(stderr, stderr_regexp, fail_if_match): ret = False return ret else: return False
def run_with_timeout(cmd, timeout): proc = subprocess.Popen(cmd) start_time = time.time() log.info("Executing: %s", cmd) while True: rc = proc.poll() if rc is not None: log.debug("Process returned %s", rc) return rc == 0 if start_time + timeout < time.time(): log.warn("WARNING: Timeout (%i) exceeded, killing process %...
def retry_command(cmd, retries, timeout, sleeptime):
def retry_command(cmd, retries, timeout, sleeptime, stdout_regexp=None, stderr_regexp=None, fail_if_match=False):
def retry_command(cmd, retries, timeout, sleeptime): # Which iteration we're on i = 0 # Current return code rc = False while True: i += 1 rc = run_with_timeout(cmd, timeout) if rc: break if retries > 0 and i >= retries: log.info("Number of retries exceeded maximum (%i), giving up.", retries) break if sleeptime: l...
rc = run_with_timeout(cmd, timeout)
rc = run_with_timeout(cmd, timeout, stdout_regexp, stderr_regexp, fail_if_match)
def retry_command(cmd, retries, timeout, sleeptime): # Which iteration we're on i = 0 # Current return code rc = False while True: i += 1 rc = run_with_timeout(cmd, timeout) if rc: break if retries > 0 and i >= retries: log.info("Number of retries exceeded maximum (%i), giving up.", retries) break if sleeptime: l...
sleeptime=options.sleeptime):
sleeptime=options.sleeptime, stdout_regexp=options.stdout_regexp, stderr_regexp=options.stderr_regexp, fail_if_match=options.fail_if_match):
def retry_command(cmd, retries, timeout, sleeptime): # Which iteration we're on i = 0 # Current return code rc = False while True: i += 1 rc = run_with_timeout(cmd, timeout) if rc: break if retries > 0 and i >= retries: log.info("Number of retries exceeded maximum (%i), giving up.", retries) break if sleeptime: l...
self.vacumm_and_reindex()
self.vacuum_and_reindex()
def increment_dates(self): """ update the dates """ last_update_seconds = ((self.last_update() / 1000) / 1000) now = int(time.time()) self.now_micro_secs = ((now * 1000) * 1000) if DEBUG: print "last update microseconds: %s" % self.last_update() print "now: %s" % self.now_micro_secs time_diff = (now - last_update_sec...
import unittest
import unittest, sys if len(sys.argv) == 3: clobberURL = sys.argv[1] dbFile = sys.argv[2] del sys.argv[2] del sys.argv[1] elif len(sys.argv) > 1: print "Usage: %s [clobberURL dbFile]" % sys.argv[0] sys.exit(1)
def testReleaseClobberPrefixBuilder(self): """Test that clobbers on release builders with the release-* prefix work""" now = int(time.time()) makeBuildDir('release-mozilla-central-linux_build', now-10) updateBuild('branch2', 'release-mozilla-central-linux_build', 'release-mozilla-central-linux_build', 'slave01', 'maste...
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age.
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 if freespace(base_dirs[0]) >= gigs: return dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir): for d i...
if freespace(base_dirs[0]) >= gigs: return
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 if freespace(base_dirs[0]) >= gigs: return dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir): for d i...
if os.path.isdir(os.path.join(base_dir, d)) and \ d not in ignore: dirs.append(os.path.join(base_dir, d)) dirs.sort(mtime_sort)
if d in ignore: continue p = os.path.join(base_dir, d) if not os.path.isdir(p): continue mtime = os.path.getmtime(p) dirs.append( (mtime, p) )
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 if freespace(base_dirs[0]) >= gigs: return dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir): for d i...
while dirs and freespace(base_dirs[0]) < gigs: d = dirs.pop(0)
dirs.sort() while dirs: mtime, d = dirs.pop(0) if (not max_age) or (mtime > max_age): if freespace(base_dirs[0]) >= gigs: break
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 if freespace(base_dirs[0]) >= gigs: return dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir): for d i...
import sys
import sys, time
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 if freespace(base_dirs[0]) >= gigs: return dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir): for d i...
parser.set_defaults(size=5, skip=[], no_presets=False, dry_run=False)
parser.set_defaults(size=5, skip=[], dry_run=False, max_age=7)
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 if freespace(base_dirs[0]) >= gigs: return dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir): for d i...
purge(args, options.size, options.skip, options.dry_run)
if options.max_age: cutoff_time = time.time() - 24*3600*options.max_age else: cutoff_time = None purge(args, options.size, options.skip, cutoff_time, options.dry_run)
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 if freespace(base_dirs[0]) >= gigs: return dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir): for d i...
m = re.search("\.ctors\s+PROGBITS\s+[0-9a-f]+\s+[0-9a-f]+\s+([0-9a-f]+)", line) if m: return int(m.group(1), 16)
f = line.split() if len(f) != 11: continue if f[1] == ".ctors" and f[2] == "PROGBITS": return int(f[5], 16) / int(f[10]) - 2; if f[1] == ".init_array" and f[2] == "PROGBITS": return int(f[5], 16) / int(f[10]);
def count_ctors(filename): proc = subprocess.Popen(['readelf', '-W', '-S', filename], stdout=subprocess.PIPE) for line in proc.stdout: m = re.search("\.ctors\s+PROGBITS\s+[0-9a-f]+\s+[0-9a-f]+\s+([0-9a-f]+)", line) if m: return int(m.group(1), 16)
f.seek(0) res = re.search(regexp, f.read())
res = re.search(regexp, read_file(f))
def search_output(f, regexp, fail_if_match): f.seek(0) res = re.search(regexp, f.read()) return xor(bool(res), fail_if_match)
fail_if_match=False):
fail_if_match=False, print_output=True):
def run_with_timeout(cmd, timeout, stdout_regexp=None, stderr_regexp=None, fail_if_match=False): stdout = TemporaryFile() stderr = TemporaryFile() proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) start_time = time.time() log.info("Executing: %s", cmd) while True: rc = proc.poll() if rc is not None: log.debug(...
stderr_regexp=None, fail_if_match=False):
stderr_regexp=None, fail_if_match=False, print_output=True):
def retry_command(cmd, retries, timeout, sleeptime, stdout_regexp=None, stderr_regexp=None, fail_if_match=False): # Which iteration we're on i = 0 # Current return code rc = False while True: i += 1 rc = run_with_timeout(cmd, timeout, stdout_regexp, stderr_regexp, fail_if_match) if rc: break if retries > 0 and i >...
fail_if_match)
fail_if_match, print_output)
def retry_command(cmd, retries, timeout, sleeptime, stdout_regexp=None, stderr_regexp=None, fail_if_match=False): # Which iteration we're on i = 0 # Current return code rc = False while True: i += 1 rc = run_with_timeout(cmd, timeout, stdout_regexp, stderr_regexp, fail_if_match) if rc: break if retries > 0 and i >...
parser.add_option("--no-output", dest="print_output", action="store_false", default=True, help="Don't print stdout/stderr output")
def retry_command(cmd, retries, timeout, sleeptime, stdout_regexp=None, stderr_regexp=None, fail_if_match=False): # Which iteration we're on i = 0 # Current return code rc = False while True: i += 1 rc = run_with_timeout(cmd, timeout, stdout_regexp, stderr_regexp, fail_if_match) if rc: break if retries > 0 and i >...
fail_if_match=options.fail_if_match):
fail_if_match=options.fail_if_match, print_output=options.print_output):
def retry_command(cmd, retries, timeout, sleeptime, stdout_regexp=None, stderr_regexp=None, fail_if_match=False): # Which iteration we're on i = 0 # Current return code rc = False while True: i += 1 rc = run_with_timeout(cmd, timeout, stdout_regexp, stderr_regexp, fail_if_match) if rc: break if retries > 0 and i >...
def sendchange(branch, username, master):
def sendchange(branch, revision, username, master):
def sendchange(branch, username, master): """Send the change to buildbot to kick off the release automation""" cmd = [ 'buildbot', 'sendchange', '--username', username, '--master', master, '--branch', branch, 'release_build' ] log.info("Executing: %s" % cmd) run_cmd(cmd)
from release_config import releaseConfig
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.branch != config['sourceRepoName']: log.error("branch passed in does not match release_configs") success = False if cmd_options.version != config['version']: log.error("version passed in does not...
if not options.branch: log.warn("No branch specified, using sourceRepoName in release_config, which may be out of date!") options.branch = releaseConfig['sourceRepoName']
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.branch != config['sourceRepoName']: log.error("branch passed in does not match release_configs") success = False if cmd_options.version != config['version']: log.error("version passed in does not...
"sourceRepoName", "l10nRepoClonePath")
"sourceRepoName")
def createRepacks(sourceRepo, revision, l10nRepoDir, l10nBaseRepo, mozconfigPath, objdir, makeDirs, appName, locales, product, version, buildNumber, stageServer, stageUsername, stageSshKey, compareLocalesRepo, merge, platform, brand): sourceRepoName = path.split(sourceRepo)[-1] localeSrcDir = path.join(sourceRepoName, ...
args = ['jarsigner', '-keystore', '$android-keystore', '-storepass', '$android-storepass', '-keypass', '$android-keypass', args[0], '$android-alias']
args = ['jarsigner', '-keystore', '$android_keystore', '-storepass', '$android_storepass', '-keypass', '$android_keypass', args[0], '$android_alias']
def processCommand(argList, cfg): """Given the command line (argList) and the parsed configuration dictionary (cfg), process the parameters for any template replacements and return a subprocess ready command list. >>> processCommand(['echo', 'param1'], {}) param1 <BLANKLINE> >>> processCommand(['echo', 'test $param']...
def mercurial(repo, dest, branch=None, revision=None,
def mercurial(repo, dest, branch=None, revision=None, update_dest=True,
def mercurial(repo, dest, branch=None, revision=None, shareBase=DefaultShareBase): """Makes sure that `dest` is has `revision` or `branch` checked out from `repo`. Do what it takes to make that happen, including possibly clobbering dest.""" dest = os.path.abspath(dest) if shareBase is DefaultShareBase: shareBase = os....
return pull(repo, dest, branch=branch, revision=revision)
return pull(repo, dest, update_dest=update_dest, branch=branch, revision=revision)
def mercurial(repo, dest, branch=None, revision=None, shareBase=DefaultShareBase): """Makes sure that `dest` is has `revision` or `branch` checked out from `repo`. Do what it takes to make that happen, including possibly clobbering dest.""" dest = os.path.abspath(dest) if shareBase is DefaultShareBase: shareBase = os....
shareBase=None)
update_dest=False, shareBase=None)
def mercurial(repo, dest, branch=None, revision=None, shareBase=DefaultShareBase): """Makes sure that `dest` is has `revision` or `branch` checked out from `repo`. Do what it takes to make that happen, including possibly clobbering dest.""" dest = os.path.abspath(dest) if shareBase is DefaultShareBase: shareBase = os....
file = '%s/raw-file/%s/mail/locales/shipped-locales' % \
file = '%s/raw-file/%s/browser/locales/shipped-locales' % \
def getShippedLocales(product, version, buildNumber, sourceRepo, hg='http://hg.mozilla.org', verbose=False): tag = '%s_%s_BUILD%s' % (product.upper(), version.replace('.', '_'), str(buildNumber)) file = '%s/raw-file/%s/mail/locales/shipped-locales' % \ (sourceRepo, tag) url = urljoin(hg, file) try: sl = urlopen(url).re...
d['usepty'] = 0
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
'leading_path' : None,
'leading_path' : '',
def fileInfo(filepath, product): """Extract information about a release file. Returns a dictionary with the following keys set: 'product', 'version', 'locale', 'platform', 'contents', 'format', 'pathstyle' 'contents' is one of 'complete', 'installer' 'format' is one of 'mar' or 'exe' 'pathstyle' is either 'short' or ...
ret['leading_path'] = None
ret['leading_path'] = ''
def fileInfo(filepath, product): """Extract information about a release file. Returns a dictionary with the following keys set: 'product', 'version', 'locale', 'platform', 'contents', 'format', 'pathstyle' 'contents' is one of 'complete', 'installer' 'format' is one of 'mar' or 'exe' 'pathstyle' is either 'short' or ...
return generate_hash(REF_PLATFORMS['build'])
else: if 'ix' in hostname: return generate_hash(REF_PLATFORMS['build-ix']) else: return generate_hash(REF_PLATFORMS['build'])
def get_ref_platform_key(hostname): if 'talos' in hostname: if 'xp' in hostname: return generate_hash(REF_PLATFORMS['talos-xp']) elif 'w7' in hostname: return generate_hash(REF_PLATFORMS['talos-win7']) else: return None return generate_hash(REF_PLATFORMS['build'])
root_file = 'moz-n900-v1.6.ubi' root_hash = '14e72cf94f5105e63c405267c68a0d2e5a4814c2'
root_file = 'moz-n900-v1.7.ubi' root_hash = '73756f692e29fb2072e5086c09003f746ac21d1c'
def validate_file(filename, good_hash, algorithm='sha1'): current_hash=hash_file(filename, algorithm=algorithm) if current_hash != good_hash: return False else: return True
elif 'tiger' in slavename or 'leopard' in slavename:
elif 'tiger' in slavename or 'leopard' in slavename or \ 'snow' in slavename:
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
elif 'talos' in slavename or '-try' in slavename:
elif 'talos' in slavename or '-try' in slavename or 'r3' in slavename:
def get_default_options(slavename): d = {'slavename': quote_option(slavename)} header = DEFAULT_HEADER footer = DEFAULT_FOOTER basedir = None buildmaster_host = None if 'moz2' in slavename or 'xserve' in slavename or 'try-' in slavename or \ slavename.startswith('win32') or slavename.startswith('mw32'): if 'try-' in sl...
os.makedirs(full_dest_dir, 0755)
try: os.makedirs(full_dest_dir, 0755) except OSError, e: if e.errno == EEXIST: print "%s already exists, continuing anyways" % full_dest_dir else: raise
def CopyFileToDir(original_file, source_dir, dest_dir, preserve_dirs=False): if not original_file.startswith(source_dir): print "%s is not in %s!" % (original_file, source_dir) return relative_path = os.path.basename(original_file) if preserve_dirs: # Add any dirs below source_dir to the final destination filePath = or...
os.chmod(os.path.join(root, d), 0755)
if 'contrib' in root: continue if 'contrib' in d: os.chmod(os.path.join(root, d), 2775) else: os.chmod(os.path.join(root, d), 0755)
def ReleaseToCandidatesDir(options, upload_dir, files): candidatesDir = CANDIDATES_DIR % {'version': options.version, 'buildnumber': options.build_number} candidatesPath = os.path.join(NIGHTLY_PATH, candidatesDir) candidatesUrl = CANDIDATES_URL_PATH % { 'nightly_dir': options.nightly_dir, 'version': options.version, 'b...
def verify_configs(branch, revision, hghost, configs_repo, staging, changesets):
def verify_configs(revision, hghost, configs_repo, changesets, filename):
def verify_configs(branch, revision, hghost, configs_repo, staging, changesets): """Check the release_configs and l10n-changesets against tagged revisions""" if staging: filename = "staging_release-firefox-%s.py" % branch configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/%s" % filenam...
if staging: filename = "staging_release-firefox-%s.py" % branch configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/%s" % filename) else: filename = "release-firefox-%s.py" % branch configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/%s" % filename)
configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/%s" % filename)
def verify_configs(branch, revision, hghost, configs_repo, staging, changesets): """Check the release_configs and l10n-changesets against tagged revisions""" if staging: filename = "staging_release-firefox-%s.py" % branch configs_url = make_hg_url(hghost, configs_repo, revision=revision, filename="mozilla/%s" % filenam...
staging = False, ) parser.add_option("-s", "--staging", dest="staging", action="store_true", help="use staging configs")
releaseConfig = None, )
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.version != config['version']: log.error("version passed in does not match release_configs") success = False if int(cmd_options.buildNumber) != int(config['buildNumber']): log.error("buildNumber p...
if options.staging: releaseConfigFile = "staging_release-firefox-%s.py" % options.branch else: releaseConfigFile = "release-firefox-%s.py" % options.branch
releaseConfigFile = options.releaseConfig
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.version != config['version']: log.error("version passed in does not match release_configs") success = False if int(cmd_options.buildNumber) != int(config['buildNumber']): log.error("buildNumber p...
options.branch,
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.version != config['version']: log.error("version passed in does not match release_configs") success = False if int(cmd_options.buildNumber) != int(config['buildNumber']): log.error("buildNumber p...
options.staging,
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.version != config['version']: log.error("version passed in does not match release_configs") success = False if int(cmd_options.buildNumber) != int(config['buildNumber']): log.error("buildNumber p...
parser.set_default(allocator_url=default_allocator_url)
parser.set_defaults(allocator_url=default_allocator_url)
def run(self): assert self.exists() sys.exit(subprocess.call([self.options.buildslave_cmd, 'start', self.options.basedir]))
log = open(LOG_FILE, 'w+') print >>log, '\n%s - starting up' % time.asctime(time.localtime())
log = open(LOG_FILE, 'a+') print >>log, '%s - starting up' % time.asctime(time.localtime())
def main(): log = open(LOG_FILE, 'w+') #don't care for long logs print >>log, '\n%s - starting up' % time.asctime(time.localtime()) log.flush() while True: rv = subprocess.call([NTPCOMMAND, NTPSERVER], stdout=log, stderr=log) if rv is 0: sys.exit(0) time.sleep(5)
rv = subprocess.call([NTPCOMMAND, NTPSERVER], stdout=log, stderr=log) if rv is 0: sys.exit(0) time.sleep(5)
up_f = open("/proc/uptime") up_s = up_f.readline() up_f.close() up_t = float(up_s.split(' ')[0]) if os.path.exists(OFFSET_FILE): off_file = open(OFFSET_FILE) off_line = off_file.readline() off_file.close() off_time = float(off_line.split(' ')[0]) else: off_time = 0 if (up_t - off_time) > MAX_UPTIME: print >> log, '%s -...
def main(): log = open(LOG_FILE, 'w+') #don't care for long logs print >>log, '\n%s - starting up' % time.asctime(time.localtime()) log.flush() while True: rv = subprocess.call([NTPCOMMAND, NTPSERVER], stdout=log, stderr=log) if rv is 0: sys.exit(0) time.sleep(5)
def sendchange(branch, revision, username, master):
def sendchange(branch, revision, username, master, configfile):
def sendchange(branch, revision, username, master): """Send the change to buildbot to kick off the release automation""" cmd = [ 'buildbot', 'sendchange', '--username', username, '--master', master, '--branch', branch, '--revision', revision, 'release_build' ] log.info("Executing: %s" % cmd) run_cmd(cmd)
releaseConfig = readReleaseConfig("staging_release-firefox-%s.py" % options.branch)
releaseConfigFile = "staging_release-firefox-%s.py" % options.branch
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.branch != config['sourceRepoName']: log.error("branch passed in does not match release_configs") success = False if cmd_options.version != config['version']: log.error("version passed in does not...
releaseConfig = readReleaseConfig("release-firefox-%s.py" % options.branch)
releaseConfigFile = "release-firefox-%s.py" % options.branch releaseConfig = readReleaseConfig(releaseConfigFile)
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.branch != config['sourceRepoName']: log.error("branch passed in does not match release_configs") success = False if cmd_options.version != config['version']: log.error("version passed in does not...
releaseConfig['milestone']
releaseConfig['milestone'],
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.branch != config['sourceRepoName']: log.error("branch passed in does not match release_configs") success = False if cmd_options.version != config['version']: log.error("version passed in does not...
args[0]
args[0], releaseConfigFile,
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.branch != config['sourceRepoName']: log.error("branch passed in does not match release_configs") success = False if cmd_options.version != config['version']: log.error("version passed in does not...
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age.
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age. Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir...
if d in ignore: continue p = os.path.join(base_dir, d) if not os.path.isdir(p): continue mtime = os.path.getmtime(p) dirs.append( (mtime, p) )
if os.path.isdir(os.path.join(base_dir, d)) and \ d not in ignore: dirs.append(os.path.join(base_dir, d)) dirs.sort(mtime_sort)
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age. Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir...
dirs.sort() while dirs: mtime, d = dirs.pop(0) if (not max_age) or (mtime > max_age): if freespace(base_dirs[0]) >= gigs: break
while dirs and freespace(base_dirs[0]) < gigs: d = dirs.pop(0)
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age. Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir...
import sys, time
import sys
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age. Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir...
parser.set_defaults(size=5, skip=[], dry_run=False, max_age=7)
parser.set_defaults(size=5, skip=[], no_presets=False, dry_run=False)
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age. Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir...
parser.add_option('', '--max-age', dest='max_age', type='int', help='''maximum age (in days) for directories. If any directory has an mtime older than this, it will be deleted, regardless of how much free space is required. Set to 0 to disable.''')
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age. Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir...
if options.max_age: cutoff_time = time.time() - 24*3600*options.max_age else: cutoff_time = None purge(args, options.size, options.skip, cutoff_time, options.dry_run)
purge(args, options.size, options.skip, options.dry_run)
def purge(base_dirs, gigs, ignore, max_age, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free. Delete any directories older than max_age. Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir...
if len(sys.argv) == 1: import doctest doctest.testmod(verbose=True) else:
parser = OptionParser(usage="usage: %prog -i [options]\n %prog [options] apk_file") parser.add_option("-i", action="store_true", dest="interactive", default=False, help="Interactive mode" ) parser.add_option("--keystore", action="store", dest="keystore", help="Specify the keystore in interactive mode" ) parser.ad...
def processCommand(argList, cfg): """Given the command line (argList) and the parsed configuration dictionary (cfg), process the parameters for any template replacements and return a subprocess ready command list. >>> processCommand(['echo', 'param1'], {}) param1 <BLANKLINE> >>> processCommand(['echo', 'test $param']...
args = sys.argv[1:]
def processCommand(argList, cfg): """Given the command line (argList) and the parsed configuration dictionary (cfg), process the parameters for any template replacements and return a subprocess ready command list. >>> processCommand(['echo', 'param1'], {}) param1 <BLANKLINE> >>> processCommand(['echo', 'test $param']...
args = ['jarsigner', '-keystore', '$android_keystore', '-storepass', '$android_storepass', '-keypass', '$android_keypass', args[0], '$android_alias']
args = command + ['-keystore', '$android_keystore', '-storepass', '$android_storepass', '-keypass', '$android_keypass', args[0], '$android_alias']
def processCommand(argList, cfg): """Given the command line (argList) and the parsed configuration dictionary (cfg), process the parameters for any template replacements and return a subprocess ready command list. >>> processCommand(['echo', 'param1'], {}) param1 <BLANKLINE> >>> processCommand(['echo', 'test $param']...
releaseConfig['sourceRepoPath'],
sourceRepoPath,
def verify_options(cmd_options, config): """Check release_configs against command-line opts""" success = True if cmd_options.version != config['version']: log.error("version passed in does not match release_configs") success = False if int(cmd_options.buildNumber) != int(config['buildNumber']): log.error("buildNumber p...
post_data += locales_post_data
post_data += "&" + locales_post_data
def product_add(self, product): if self.verbose: print "Adding product: %s" % product if self.locales: print "Locales: %s" % ", ".join(self.locales) post_data = "product=" + quote(product) if self.locales: locales_post_data = ["languages=%s" % l for l in self.locales] locales_post_data = "&".join(locales_post_data) pos...
ReleaseToBuildDir(SHADOW_CENTRAL_DIR, SHADOW_CENTRAL_URL_PATH, options, upload_dir, files, dated)
options.product = "shadow-central" ReleaseToBuildDir(PVT_BUILD_DIR, PVT_BUILD_URL_PATH, options, upload_dir, files, dated)
def ReleaseToShadowCentralBuilds(options, upload_dir, files, dated=True): ReleaseToBuildDir(SHADOW_CENTRAL_DIR, SHADOW_CENTRAL_URL_PATH, options, upload_dir, files, dated)
help="Copy files to $product/shadow-central-builds/$tinderbox_builds_dir/$timestamp")
help="Copy files to shadow-central/$tinderbox_builds_dir/$timestamp")
def ReleaseToTryserverBuilds(options, upload_dir, files): tryserverBuildsPath = TRYSERVER_DIR % {'product': options.product, 'who': options.who, 'revision': options.revision, 'builddir': options.builddir} tryserverBuildsUrl = TRYSERVER_URL_PATH % {'product': options.product, 'who': options.who, 'revision': options.revi...
parser.set_defaults(size=5, skip=[], no_presets=False, dry_run=False)
parser.set_defaults(size=5, skip=[], dry_run=False, max_age=28)
def purge(base_dirs, gigs, ignore, dry_run=False): """Delete directories under `base_dirs` until `gigs` GB are free Will not delete directories listed in the ignore list.""" gigs *= 1024 * 1024 * 1024 if freespace(base_dirs[0]) >= gigs: return dirs = [] for base_dir in base_dirs: if os.path.exists(base_dir): for d i...