rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.assert_(title in ( "Hello, " + snowman + "!", "Hello, " + sm2 + "!"), repr(title))
for snowman in snowmen: if title == "Hello, " + snowman + "!": break else: self.fail("unexpected ps output: %r" % title)
def test_unicode(self): """Title can contain unicode characters.""" if 'utf-8' != sys.getdefaultencoding(): raise SkipTest("encoding '%s' can't deal with snowmen" % sys.getdefaultencoding())
def run_script(self, script, args=None):
def test_issue_8(self): """Test that the module works with 'python -m'.""" module = 'spt_issue_8' pypath = os.environ.get('PYTHONPATH', None) dir = tempfile.mkdtemp() os.environ['PYTHONPATH'] = dir + os.pathsep + (pypath or '') try: open(dir + '/' + module + '.py', 'w').write( self._clean_whitespaces(r""" import setproctitle setproctitle.setproctitle("X" * 40) print open("/proc/self/cmdline").read() """)) rv = self.run_script(args="-m " + module) self.assertEqual(rv.replace('\x00', ' ').rstrip(), 'X' * 40) finally: shutil.rmtree(dir, ignore_errors=True) if pypath is not None: os.environ['PYTHONPATH'] = pypath else: del os.environ['PYTHONPATH'] def run_script(self, script=None, args=None):
def run_script(self, script, args=None): """run a script in a separate process.
script = self._clean_whitespaces(script)
def run_script(self, script, args=None): """run a script in a separate process.
setproctitle.setproctitle("X" * 40) import sys if 'bsd' in sys.platform: print open("/proc/curproc/cmdline").read() else: print open("/proc/self/cmdline").read()
setproctitle.setproctitle("Hello, module!") import os print os.getpid() print os.popen("ps -o pid,command 2> /dev/null").read()
def test_issue_8(self): """Test that the module works with 'python -m'.""" module = 'spt_issue_8' pypath = os.environ.get('PYTHONPATH', None) dir = tempfile.mkdtemp() os.environ['PYTHONPATH'] = dir + os.pathsep + (pypath or '') try: open(dir + '/' + module + '.py', 'w').write( self._clean_whitespaces(r""" import setproctitle setproctitle.setproctitle("X" * 40)
rv = self._clean_up_title(rv) self.assert_(rv.startswith('X' * 40))
lines = filter(None, rv.splitlines()) pid = lines.pop(0) pids = dict([r.strip().split(None, 1) for r in lines]) title = self._clean_up_title(pids[pid]) self.assertEqual(title, "Hello, module!")
def test_issue_8(self): """Test that the module works with 'python -m'.""" module = 'spt_issue_8' pypath = os.environ.get('PYTHONPATH', None) dir = tempfile.mkdtemp() os.environ['PYTHONPATH'] = dir + os.pathsep + (pypath or '') try: open(dir + '/' + module + '.py', 'w').write( self._clean_whitespaces(r""" import setproctitle setproctitle.setproctitle("X" * 40)
title = pids[pid] if 'bsd' in sys.platform: procname = os.path.basename(sys.executable) title = ' '.join([t for t in title.split(' ') if procname not in t])
title = self._clean_up_title(pids[pid])
def test_setproctitle(self): """setproctitle() can set the process title, duh.""" rv = self.run_script(r""" import setproctitle setproctitle.setproctitle('Hello, world!')
print open("/proc/self/cmdline").read()
import sys if 'bsd' in sys.platform: print open("/proc/curproc/cmdline").read() else: print open("/proc/self/cmdline").read()
def test_issue_8(self): """Test that the module works with 'python -m'.""" module = 'spt_issue_8' pypath = os.environ.get('PYTHONPATH', None) dir = tempfile.mkdtemp() os.environ['PYTHONPATH'] = dir + os.pathsep + (pypath or '') try: open(dir + '/' + module + '.py', 'w').write( self._clean_whitespaces(r""" import setproctitle setproctitle.setproctitle("X" * 40) print open("/proc/self/cmdline").read() """))
self.assertEqual(rv.replace('\x00', ' ').rstrip(), 'X' * 40)
rv = self._clean_up_title(rv) self.assert_(rv.startswith('X' * 40))
def test_issue_8(self): """Test that the module works with 'python -m'.""" module = 'spt_issue_8' pypath = os.environ.get('PYTHONPATH', None) dir = tempfile.mkdtemp() os.environ['PYTHONPATH'] = dir + os.pathsep + (pypath or '') try: open(dir + '/' + module + '.py', 'w').write( self._clean_whitespaces(r""" import setproctitle setproctitle.setproctitle("X" * 40) print open("/proc/self/cmdline").read() """))
if the script completes successfully, return the concatenation of ``stdout`` and ``stderr``. else fail.
if the script completes successfully, return its ``stdout``, else fail the test.
def run_script(self, script=None, args=None): """run a script in a separate process.
stdin=PIPE, stdout=PIPE, stderr=STDOUT,
stdin=PIPE, stdout=PIPE, stderr=PIPE,
def run_script(self, script=None, args=None): """run a script in a separate process.
out = proc.communicate(script)[0]
out, err = proc.communicate(script)
def run_script(self, script=None, args=None): """run a script in a separate process.
:rtype: :class:`~twod.wsgi.request.DjangoApplication`
:rtype: :class:`~twod.wsgi.handler.DjangoApplication`
def wsgify_django(global_config, **local_conf): """ Load the Django application for use in a WSGI server. :raises ImportError: If the Django settings module cannot be imported. :raises ValueError: If ``local_conf`` contains a Django setting which is not supported. :raises ValueError: If the ``django_settings_module`` directive is not set. :raises ValueError: If Django's ``DEBUG`` is set instead of Paste's ``debug``. :return: The Django application as a WSGI application. :rtype: :class:`~twod.wsgi.request.DjangoApplication` """ _set_up_settings(global_config, local_conf) return DjangoApplication()
django_view = make_wsgi_view(app, "/blog")
def test_string_as_response(self): app = MockApp("200 It is OK", [("X-HEADER", "Foo")]) django_view = make_wsgi_view(app, "/blog") # Running a request: environ = complete_environ(SCRIPT_NAME="/dev", PATH_INFO="/blog/posts") request = make_request(**environ) # Checking the response: django_response = django_view(request) http_response = ( "X-HEADER: Foo\n" "Content-Type: text/html; charset=utf-8\n" "\n" "body" ) eq_(http_response, str(django_response))
django_response = django_view(request)
def test_string_as_response(self): app = MockApp("200 It is OK", [("X-HEADER", "Foo")]) django_view = make_wsgi_view(app, "/blog") # Running a request: environ = complete_environ(SCRIPT_NAME="/dev", PATH_INFO="/blog/posts") request = make_request(**environ) # Checking the response: django_response = django_view(request) http_response = ( "X-HEADER: Foo\n" "Content-Type: text/html; charset=utf-8\n" "\n" "body" ) eq_(http_response, str(django_response))
django_view = make_wsgi_view(app, "/blog")
def test_iterable_as_response(self): app = MockGeneratorApp("200 It is OK", [("X-HEADER", "Foo")]) django_view = make_wsgi_view(app, "/blog") # Running a request: environ = complete_environ(SCRIPT_NAME="/dev", PATH_INFO="/blog/posts") request = make_request(**environ) # Checking the response: django_response = django_view(request) assert_false(django_response._is_string) ok_(django_response.has_header("X-HEADER")) http_response = ( "X-HEADER: Foo\n" "Content-Type: text/html; charset=utf-8\n" "\n" "body as iterable" ) eq_(http_response, str(django_response))
django_response = django_view(request)
def test_iterable_as_response(self): app = MockGeneratorApp("200 It is OK", [("X-HEADER", "Foo")]) django_view = make_wsgi_view(app, "/blog") # Running a request: environ = complete_environ(SCRIPT_NAME="/dev", PATH_INFO="/blog/posts") request = make_request(**environ) # Checking the response: django_response = django_view(request) assert_false(django_response._is_string) ok_(django_response.has_header("X-HEADER")) http_response = ( "X-HEADER: Foo\n" "Content-Type: text/html; charset=utf-8\n" "\n" "body as iterable" ) eq_(http_response, str(django_response))
django_view = make_wsgi_view(app, "/blog")
def test_write_response(self): app = MockWriteApp("200 It is OK", [("X-HEADER", "Foo")]) django_view = make_wsgi_view(app, "/blog") # Running a request: environ = complete_environ(SCRIPT_NAME="/dev", PATH_INFO="/blog/posts") request = make_request(**environ) # Checking the response: django_response = django_view(request) assert_false(django_response._is_string) ok_(django_response.has_header("X-HEADER")) http_response = ( "X-HEADER: Foo\n" "Content-Type: text/html; charset=utf-8\n" "\n" "body as iterable" ) eq_(http_response, str(django_response))
django_response = django_view(request)
def test_write_response(self): app = MockWriteApp("200 It is OK", [("X-HEADER", "Foo")]) django_view = make_wsgi_view(app, "/blog") # Running a request: environ = complete_environ(SCRIPT_NAME="/dev", PATH_INFO="/blog/posts") request = make_request(**environ) # Checking the response: django_response = django_view(request) assert_false(django_response._is_string) ok_(django_response.has_header("X-HEADER")) http_response = ( "X-HEADER: Foo\n" "Content-Type: text/html; charset=utf-8\n" "\n" "body as iterable" ) eq_(http_response, str(django_response))
django_view = make_wsgi_view(app, "/blog")
def test_closure_response(self): """The .close() method in the response (if any) must be kept.""" app = MockClosingApp("200 It is OK", []) django_view = make_wsgi_view(app, "/blog") # Running a request: environ = complete_environ(SCRIPT_NAME="/dev", PATH_INFO="/blog/posts") request = make_request(**environ) django_response = django_view(request) # Checking the .close() call: assert_false(app.app_iter.closed) django_response.close() ok_(app.app_iter.closed)
django_response = django_view(request)
django_response = call_wsgi_app(app, request, "/blog")
def test_closure_response(self): """The .close() method in the response (if any) must be kept.""" app = MockClosingApp("200 It is OK", []) django_view = make_wsgi_view(app, "/blog") # Running a request: environ = complete_environ(SCRIPT_NAME="/dev", PATH_INFO="/blog/posts") request = make_request(**environ) django_response = django_view(request) # Checking the .close() call: assert_false(app.app_iter.closed) django_response.close() ok_(app.app_iter.closed)
logfile = options.logfile
if options.logfile: logfile = options.logfile
def Cleanup(ret):
qbk_file = xml_file.replace('.xml', '.qbk')
qbk_file = os.path.normpath(xml_file.replace('.xml', '.qbk')).replace('\\', '/')
def hash_qbk_file(self, xml_file): qbk_file = xml_file.replace('.xml', '.qbk') if(not os.path.isfile(qbk_file)): return (None, None) with open(qbk_file) as file: return (qbk_file, hashlib.sha256(file.read()).hexdigest())
self.mox.StubOutWithMock(hesiod, 'Lookup')
self.mox.StubOutWithMock(hesiod, 'Lookup', use_mock_anything=True)
def setUp(self): super(TestHesiodLookup, self).setUp()
s.settimeout(0, 3)
s.settimeout(0.3)
def is_cups_server(rm): """See if a host is accepting connections on port 631. Args: A hostname Returns: True if the server is accepting connections, otherwise False """ try: s = socket.socket() s.settimeout(0, 3) s.connect((rm, 631)) s.close() return True except (socket.error, socket.timeout): return False
default = cups.getDefault()
default = cupsd.getDefault()
def get_default_printer(): """Find and return the default printer""" _setup() if 'PRINTER' in os.environ: return os.environ['PRINTER'] if cupsd: default = cups.getDefault() if default: return default for result in _hesiod_lookup(socket.getfqdn(), 'cluster'): key, value = result.split(None, 1) if key == 'lpr': return value
redis.srem(self.__class__.categories_key, category)
self.redis.srem(self.__class__.categories_key, category)
def classify(self, text): scores = {}
self.command_timeout = getattr(self.settings_dict, 'COMMAND_TIMEOUT', 30) if type(self.command_timeout) != int:
try: self.command_timeout = int(self.settings_dict.get('COMMAND_TIMEOUT', 30)) except ValueError:
def __init__(self, *args, **kwargs): super(DatabaseWrapper, self).__init__(*args, **kwargs) self.features = DatabaseFeatures() self.ops = DatabaseOperations() self.client = BaseDatabaseClient(self) self.creation = DatabaseCreation(self) self.introspection = DatabaseIntrospection(self) self.validation = BaseDatabaseValidation(self)
raise exceptions.ValidationError(
raise ValidationError(
def to_python(self, value): if value is None: return value try: return long(value) except (TypeError, ValueError): raise exceptions.ValidationError( _("This value must be an long."))
self.assertRaises(Exception, test_view('stock_supply_day'))
test_view('stock_supply_day')
def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view('stock_supply_day'))
raise KeyError("Field %s not found" % field_name)
found = False for group in getattr(form, 'groups', []): if field_name in group.fields: found = True break if not found: raise KeyError("Field %s not found" % field_name)
def move(form, field_name, before=None, after=None, prefix=None, relative_prefix=None): """Move the field with the given name before or after another field. """ if prefix: field_name = expandPrefix(prefix) + field_name if before and after: raise ValueError(u"Only one of 'before' or 'after' is allowed") offset = 0 if after: offset = 1 relative = orig_relative = before or after if relative_prefix: relative = expandPrefix(relative_prefix) + relative if field_name not in form.fields: raise KeyError("Field %s not found" % field_name) if relative != '*' and relative not in form.fields: found = False for group in form.groups: if relative in group.fields: found = True break if not found: raise KeyError("Field %s not found" % relative) field = remove(form, field_name) group = None index = None if relative in form.fields: index = form.fields.keys().index(relative) elif orig_relative == '*' and relative_prefix is None: if before: index = 0 else: index = len(form.fields.keys()) - 1 else: for group in form.groups: if relative in group.fields: index = group.fields.keys().index(relative) break elif orig_relative == '*' and relative_prefix == group.prefix: if before: index = 0 else: index = len(group.fields.keys()) - 1 if index is None: raise KeyError("Field %s not found" % relative) add(form, field, group=group, index=index+offset)
install_glob(srcdir('html/ops/*.php'), dir('html/ops/')) install_glob(srcdir('html/ops/*.inc'), dir('html/ops/'))
def dir(*dirs): return apply(os.path.join,(dest_dir,)+dirs)
install(srcdir('html/ops', 'sample_server_status.php'), self.dir('html/user/server_status.php'))
def install_project(self, scheduler_file = None): if os.path.exists(self.dir()): raise SystemExit('Project directory "%s" already exists; this would clobber it!'%self.dir())
my_symlink(dir('html/user_profile'), dir('html/user/user_profile'));
try: my_symlink(dir('html/user_profile'), dir('html/user/user_profile')); except: pass
def dir(*dirs): return apply(os.path.join,(dest_dir,)+dirs)
if fn.rfind('.c') or fn.rfind('.C') or fn.rfind('.cpp'):
if fn.rfind('.c') != -1 or fn.rfind('.C') != -1 or fn.rfind('.cpp') != -1:
def _get_filetype(fn): if fn.rfind('.c') or fn.rfind('.C') or fn.rfind('.cpp'): return 1 # assimble file type if fn.rfind('.s') or fn.rfind('.S'): return 2 # header type if fn.rfind('.h'): return 5 # other filetype return 5
if fn.rfind('.s') or fn.rfind('.S'):
if fn.rfind('.s') != -1 or fn.rfind('.S') != -1:
def _get_filetype(fn): if fn.rfind('.c') or fn.rfind('.C') or fn.rfind('.cpp'): return 1 # assimble file type if fn.rfind('.s') or fn.rfind('.S'): return 2 # header type if fn.rfind('.h'): return 5 # other filetype return 5
if fn.rfind('.h'):
if fn.rfind('.h') != -1:
def _get_filetype(fn): if fn.rfind('.c') or fn.rfind('.C') or fn.rfind('.cpp'): return 1 # assimble file type if fn.rfind('.s') or fn.rfind('.S'): return 2 # header type if fn.rfind('.h'): return 5 # other filetype return 5
lines.insert(line_index, 'File %d,%d<%s><%s>\r\n'
lines.insert(line_index, 'File %d,%d,<%s><%s>\r\n'
def MDKProject(target, script): template = file(RTT_ROOT + '/scons_script/template.uV2', "rb") lines = template.readlines() project = file(target, "wb") project_path = os.path.dirname(os.path.abspath(target)) line_index = 5 # write group for group in script: lines.insert(line_index, 'Group (%s)\r\n' % group['name']) line_index += 1 lines.insert(line_index, '\r\n') line_index += 1 # write file CPPPATH = [] CPPDEFINES = [] LINKFLAGS = '' CCFLAGS = '' # number of groups group_index = 1 for group in script: # print group['name'] # get each include path if group.has_key('CPPPATH') and group['CPPPATH']: if CPPPATH: CPPPATH += group['CPPPATH'] else: CPPPATH += group['CPPPATH'] # get each group's definitions if group.has_key('CPPDEFINES') and group['CPPDEFINES']: if CPPDEFINES: CPPDEFINES += ';' + group['CPPDEFINES'] else: CPPDEFINES += group['CPPDEFINES'] # get each group's link flags if group.has_key('LINKFLAGS') and group['LINKFLAGS']: if LINKFLAGS: LINKFLAGS += ' ' + group['LINKFLAGS'] else: LINKFLAGS += group['LINKFLAGS'] # generate file items for node in group['src']: fn = node.rfile() name = fn.name path = os.path.dirname(fn.abspath) path = _make_path_relative(project_path, path) path = os.path.join(path, name) lines.insert(line_index, 'File %d,%d<%s><%s>\r\n' % (group_index, _get_filetype(name), path, name)) line_index += 1 group_index = group_index + 1 lines.insert(line_index, '\r\n') line_index += 1 # remove repeat path paths = set() for path in CPPPATH: inc = _make_path_relative(project_path, os.path.normpath(path)) paths.add(inc) #.replace('\\', '/') paths = [i for i in paths] CPPPATH = string.join(paths, ';') definitions = [i for i in set(CPPDEFINES)] CPPDEFINES = string.join(definitions, ', ') while line_index < len(lines): if lines[line_index].startswith(' ADSCINCD '): lines[line_index] = ' ADSCINCD (' + CPPPATH + ')\r\n' if lines[line_index].startswith(' ADSLDMC ('): lines[line_index] = ' ADSLDMC (' + LINKFLAGS + ')\r\n' if lines[line_index].startswith(' ADSCDEFN ('): lines[line_index] = ' ADSCDEFN (' + CPPDEFINES + ')\r\n' line_index += 1 # write project for line in lines: project.write(line) project.close()
global error global parse_file global success
global error, parse_file, success, parser
def p_error(tok): global error global parse_file global success error = "%s: Syntax error on line %d %s [type=%s]" % (parse_file, tok.lineno, tok.value, tok.type) print error success = False
lexer.lexdata = [] lexer.lexpos = 0 lexer.lineno = 1
global error, parser, lexer, success success = True
def parse(text, module=None, support=None, debug=False): create_globals(module, support, debug) lexer.lexdata = [] lexer.lexpos = 0 lexer.lineno = 1 try: parser.parse(text, debug=debug) except Exception, e: global error error = "internal parser error: %s" % str(e) + "\n" + traceback.format_exc() if error is not None: msg = 'could not parse text: "%s"' % error raise ValueError(msg) return m
parser.parse(text, debug=debug)
parser.parse(text, debug=debug, lexer=lexer)
def parse(text, module=None, support=None, debug=False): create_globals(module, support, debug) lexer.lexdata = [] lexer.lexpos = 0 lexer.lineno = 1 try: parser.parse(text, debug=debug) except Exception, e: global error error = "internal parser error: %s" % str(e) + "\n" + traceback.format_exc() if error is not None: msg = 'could not parse text: "%s"' % error raise ValueError(msg) return m
global error
parser = None lexer = None
def parse(text, module=None, support=None, debug=False): create_globals(module, support, debug) lexer.lexdata = [] lexer.lexpos = 0 lexer.lineno = 1 try: parser.parse(text, debug=debug) except Exception, e: global error error = "internal parser error: %s" % str(e) + "\n" + traceback.format_exc() if error is not None: msg = 'could not parse text: "%s"' % error raise ValueError(msg) return m
if error is not None:
if not success: parser = None
def parse(text, module=None, support=None, debug=False): create_globals(module, support, debug) lexer.lexdata = [] lexer.lexpos = 0 lexer.lineno = 1 try: parser.parse(text, debug=debug) except Exception, e: global error error = "internal parser error: %s" % str(e) + "\n" + traceback.format_exc() if error is not None: msg = 'could not parse text: "%s"' % error raise ValueError(msg) return m
blacklist = ["init.if", "inetd.if", "uml.if", "thunderbird.if"]
def list_headers(root): modules = [] support_macros = None blacklist = ["init.if", "inetd.if", "uml.if", "thunderbird.if"] for dirpath, dirnames, filenames in os.walk(root): for name in filenames: # FIXME: these make the parser barf in various unrecoverable ways, so we must skip # them. if name in blacklist: continue modname = os.path.splitext(name) filename = os.path.join(dirpath, name) if modname[1] == '.spt': if name == "obj_perm_sets.spt": support_macros = filename elif len(re.findall("patterns", modname[0])): modules.append((modname[0], filename)) elif modname[1] == '.if': modules.append((modname[0], filename)) return (modules, support_macros)
if name in blacklist: continue
def list_headers(root): modules = [] support_macros = None blacklist = ["init.if", "inetd.if", "uml.if", "thunderbird.if"] for dirpath, dirnames, filenames in os.walk(root): for name in filenames: # FIXME: these make the parser barf in various unrecoverable ways, so we must skip # them. if name in blacklist: continue modname = os.path.splitext(name) filename = os.path.join(dirpath, name) if modname[1] == '.spt': if name == "obj_perm_sets.spt": support_macros = filename elif len(re.findall("patterns", modname[0])): modules.append((modname[0], filename)) elif modname[1] == '.if': modules.append((modname[0], filename)) return (modules, support_macros)
self.settings["CFLAGS"]="-Os -march=armv4 -pipe"
self.settings["CFLAGS"]+=" -march=armv4"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv4l-unknown-linux-gnu" self.settings["CFLAGS"]="-Os -march=armv4 -pipe"
self.settings["CFLAGS"]="-Os -march=armv4t -pipe" class arch_armv5l(generic_arm): "Builder class for armv5l target" def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv5l-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv5 -pipe"
self.settings["CFLAGS"]+=" -march=armv4t"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv4tl-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv4t -pipe"
self.settings["CFLAGS"]="-Os -march=armv5t -pipe"
self.settings["CFLAGS"]+=" -march=armv5t"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv5tl-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv5t -pipe"
self.settings["CFLAGS"]="-Os -march=armv5te -pipe"
self.settings["CFLAGS"]+=" -march=armv5te"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv5tel-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv5te -pipe"
self.settings["CFLAGS"]="-Os -march=armv5te -pipe"
self.settings["CFLAGS"]+=" -march=armv5te"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv5tejl-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv5te -pipe"
class arch_armv6l(generic_arm): "Builder class for armv6l target"
class arch_armv6j(generic_arm): "Builder class for armv6j target"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv5tejl-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv5te -pipe"
self.settings["CHOST"]="armv6l-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6 -pipe"
self.settings["CHOST"]="armv6j-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv6j -mfpu=vfp -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6l-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6 -pipe"
class arch_armv6jl(generic_arm): "Builder class for armv6jl target"
class arch_armv6t2(generic_arm): "Builder class for armv6t2 target"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6l-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6 -pipe"
self.settings["CHOST"]="armv6jl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6j -pipe"
self.settings["CHOST"]="armv6t2-unknown-linux-gnueabi" self.settings["CFLAGS"]=" -march=armv6t2 -mfpu=vfp -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6jl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6j -pipe"
class arch_armv6t2l(generic_arm): "Builder class for armv6t2l target"
class arch_armv6z(generic_arm): "Builder class for armv6z target"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6jl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6j -pipe"
self.settings["CHOST"]="armv6t2l-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6t2 -pipe"
self.settings["CHOST"]="armv6z-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv6z -mfpu=vfp -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6t2l-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6t2 -pipe"
class arch_armv6zl(generic_arm): "Builder class for armv6zl target"
class arch_armv6zk(generic_arm): "Builder class for armv6zk target"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6t2l-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6t2 -pipe"
self.settings["CHOST"]="armv6zl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6z -pipe"
self.settings["CHOST"]="armv6zk-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv6zk -mfpu=vfp -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6zl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6z -pipe"
class arch_armv6zkl(generic_arm): "Builder class for armv6zkl target"
class arch_armv7a(generic_arm): "Builder class for armv7a target"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6zl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6z -pipe"
self.settings["CHOST"]="armv6zkl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6zk -pipe"
self.settings["CHOST"]="armv7a-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfp -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6zkl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6zk -pipe"
class arch_armv7l(generic_arm): "Builder class for armv7l target"
class arch_armv7r(generic_arm): "Builder class for armv7r target"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6zkl-softloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv6zk -pipe"
self.settings["CHOST"]="armv7l-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv7 -pipe"
self.settings["CHOST"]="armv7rl-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-r -mfpu=vfp -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7l-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv7 -pipe"
class arch_armv7al(generic_arm): "Builder class for armv7al target"
class arch_armv7m(generic_arm): "Builder class for armv7m target"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7l-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv7 -pipe"
self.settings["CHOST"]="armv7al-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv7-a -pipe" class arch_armv7rl(generic_arm): "Builder class for armv7rl target" def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7ml-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv7-r -pipe" class arch_armv7ml(generic_arm): "Builder class for armv7ml target" def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7ml-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv7-m -pipe"
self.settings["CHOST"]="armv7m-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-m -mfpu=vfp -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7al-softfloat-linux-gnueabi" self.settings["CFLAGS"]="-Os -march=armv7-a -pipe"
"armv5l" : arch_armv5l,
def register(): "Inform main catalyst program of the contents of this plugin." return ({ "arm" : arch_arm, "armv4l" : arch_armv4l, "armv4tl": arch_armv4tl, "armv5l" : arch_armv5l, "armv5tl": arch_armv5tl, "armv5tel": arch_armv5tel, "armv5tejl": arch_armv5tejl, "armv6l" : arch_armv6l, "armv6jl" : arch_armv6jl, "armv6t2l" : arch_armv6t2l, "armv6zl" : arch_armv6zl, "armv6zkl" : arch_armv6zkl, "armv7l" : arch_armv7l, "armv7al" : arch_armv7al, "armv7rl" : arch_armv7rl, "armv7ml" : arch_armv7ml, "armeb" : arch_armeb, "armv5teb" : arch_armv5teb }, ("arm", "armv4l", "armv4tl", "armv5l", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
"armv6l" : arch_armv6l, "armv6jl" : arch_armv6jl, "armv6t2l" : arch_armv6t2l, "armv6zl" : arch_armv6zl, "armv6zkl" : arch_armv6zkl, "armv7l" : arch_armv7l, "armv7al" : arch_armv7al, "armv7rl" : arch_armv7rl, "armv7ml" : arch_armv7ml,
"armv6j" : arch_armv6j, "armv6t2" : arch_armv6t2, "armv6z" : arch_armv6z, "armv6zk" : arch_armv6zk, "armv7a" : arch_armv7a, "armv7r" : arch_armv7r, "armv7m" : arch_armv7m,
def register(): "Inform main catalyst program of the contents of this plugin." return ({ "arm" : arch_arm, "armv4l" : arch_armv4l, "armv4tl": arch_armv4tl, "armv5l" : arch_armv5l, "armv5tl": arch_armv5tl, "armv5tel": arch_armv5tel, "armv5tejl": arch_armv5tejl, "armv6l" : arch_armv6l, "armv6jl" : arch_armv6jl, "armv6t2l" : arch_armv6t2l, "armv6zl" : arch_armv6zl, "armv6zkl" : arch_armv6zkl, "armv7l" : arch_armv7l, "armv7al" : arch_armv7al, "armv7rl" : arch_armv7rl, "armv7ml" : arch_armv7ml, "armeb" : arch_armeb, "armv5teb" : arch_armv5teb }, ("arm", "armv4l", "armv4tl", "armv5l", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
}, ("arm", "armv4l", "armv4tl", "armv5l", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
}, ("arm", "armv4l", "armv4tl", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
def register(): "Inform main catalyst program of the contents of this plugin." return ({ "arm" : arch_arm, "armv4l" : arch_armv4l, "armv4tl": arch_armv4tl, "armv5l" : arch_armv5l, "armv5tl": arch_armv5tl, "armv5tel": arch_armv5tel, "armv5tejl": arch_armv5tejl, "armv6l" : arch_armv6l, "armv6jl" : arch_armv6jl, "armv6t2l" : arch_armv6t2l, "armv6zl" : arch_armv6zl, "armv6zkl" : arch_armv6zkl, "armv7l" : arch_armv7l, "armv7al" : arch_armv7al, "armv7rl" : arch_armv7rl, "armv7ml" : arch_armv7ml, "armeb" : arch_armeb, "armv5teb" : arch_armv5teb }, ("arm", "armv4l", "armv4tl", "armv5l", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
"loongson" : arch_mipsel3,
"loongson2e" : arch_loongson2e, "loongson2e_n32" : arch_loongson2e_n32, "loongson2f" : arch_loongson2f, "loongson2f_n32" : arch_loongson2f_n32,
def __init__(self,myspec): arch_mips4_n32.__init__(self,myspec) self.settings["HOSTUSE"]=["ip30","n32"]
class arch_loongson2e(generic_mipsel): "Builder class for all Loongson 2E [Little-endian]" def __init__(self,myspec): generic_mipsel.__init__(self,myspec) self.settings["CFLAGS"]="-O2 -march=loongson2e -mabi=32 -pipe -mplt" class arch_loongson2e_n32(generic_mipsel): "Builder class for all Loongson 2E [Little-endian N32]" def __init__(self,myspec): generic_mipsel.__init__(self,myspec) self.settings["CFLAGS"]="-O2 -march=loongson2e -mabi=n32 -pipe -mplt" self.settings["CHOST"]="mips64el-unknown-linux-gnu" self.settings["HOSTUSE"]=["n32"] class arch_loongson2f(generic_mipsel): "Builder class for all Loongson 2F [Little-endian]" def __init__(self,myspec): generic_mipsel.__init__(self,myspec) self.settings["CFLAGS"]="-O3 -march=loongson2f -mabi=32 -pipe -mplt --Wa,-mfix-loongson2f-nop" class arch_loongson2f_n32(generic_mipsel): "Builder class for all Loongson 2F [Little-endian N32]" def __init__(self,myspec): generic_mipsel.__init__(self,myspec) self.settings["CFLAGS"]="-O3 -march=loongson2f -mabi=n32 -pipe -mplt -Wa,-mfix-loongson2f-nop" self.settings["CHOST"]="mips64el-unknown-linux-gnu" self.settings["HOSTUSE"]=["n32"]
def __init__(self,myspec): generic_mipsel.__init__(self,myspec) self.settings["CFLAGS"]="-O2 -mips3 -mabi=n32 -pipe" self.settings["CHOST"]="mips64el-unknown-linux-gnu" self.settings["HOSTUSE"]=["n32"]
"loongson2e" : arch_loongson2e, "loongson2e_n32" : arch_loongson2e_n32, "loongson2f" : arch_loongson2f, "loongson2f_n32" : arch_loongson2f_n32,
"loongson" : arch_mipsel3,
def __init__(self,myspec): arch_mips4_n32.__init__(self,myspec) self.settings["HOSTUSE"]=["ip30","n32"]
self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hardfp"
self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7a-hardfloat-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hardfp"
"armv5l" : arch_armv5l,
def __init__(self,myspec): generic_armeb.__init__(self,myspec) self.settings["CFLAGS"]+=" -mcpu=xscale" self.settings["CHOST"]="armv5teb-softfloat-linux-gnueabi"
"armv5teb" : arch_armv5teb,
def __init__(self,myspec): generic_armeb.__init__(self,myspec) self.settings["CFLAGS"]+=" -mcpu=xscale" self.settings["CHOST"]="armv5teb-softfloat-linux-gnueabi"
"armv6l" : arch_armv6l, "armv6jl" : arch_armv6jl, "armv6t2l" : arch_armv6t2l, "armv6zl" : arch_armv6zl, "armv6zkl" : arch_armv6zkl, "armv7l" : arch_armv7l, "armv7al" : arch_armv7al, "armv7rl" : arch_armv7rl, "armv7ml" : arch_armv7ml, "armeb" : arch_armeb
"armv6j" : arch_armv6j, "armv6t2" : arch_armv6t2, "armv6z" : arch_armv6z, "armv6zk" : arch_armv6zk, "armv7a" : arch_armv7a, "armv7r" : arch_armv7r, "armv7m" : arch_armv7m, "armeb" : arch_armeb, "armv5teb" : arch_armv5teb
def __init__(self,myspec): generic_armeb.__init__(self,myspec) self.settings["CFLAGS"]+=" -mcpu=xscale" self.settings["CHOST"]="armv5teb-softfloat-linux-gnueabi"
_machine_map = ("arm", "armv4l", "armv4tl", "armv5l", "armv5tl", "armv5tel", "armv5tejl", "armv6l", "armv7l", "armeb", "armv5teb")
_machine_map = ("arm", "armv4l", "armv4tl", "armv5tl", "armv5tel", "armv5tejl", "armv6l", "armv7l", "armeb", "armv5teb")
def __init__(self,myspec): generic_armeb.__init__(self,myspec) self.settings["CFLAGS"]+=" -mcpu=xscale" self.settings["CHOST"]="armv5teb-softfloat-linux-gnueabi"
class arch_armv6t2(generic_arm): "Builder class for armv6t2 target" def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6t2-unknown-linux-gnueabi" self.settings["CFLAGS"]=" -march=armv6t2 -mfpu=vfp -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv6j-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv6j -mfpu=vfp -mfloat-abi=softfp"
self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfp -mfloat-abi=softfp" class arch_armv7r(generic_arm): "Builder class for armv7r target" def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7r-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-r -mfpu=vfp -mfloat-abi=softfp" class arch_armv7m(generic_arm): "Builder class for armv7m target" def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7m-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-m -mfpu=vfp -mfloat-abi=softfp"
self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7a-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfp -mfloat-abi=softfp"
self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfp -mfloat-abi=hard"
self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7a-hardfloat-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfp -mfloat-abi=hard"
"armv6t2" : arch_armv6t2,
def __init__(self,myspec): generic_armeb.__init__(self,myspec) self.settings["CFLAGS"]+=" -mcpu=xscale" self.settings["CHOST"]="armv5teb-softfloat-linux-gnueabi"
"armv7r" : arch_armv7r, "armv7m" : arch_armv7m,
def __init__(self,myspec): generic_armeb.__init__(self,myspec) self.settings["CFLAGS"]+=" -mcpu=xscale" self.settings["CHOST"]="armv5teb-softfloat-linux-gnueabi"
self.settings["CHOST"]="armv7rl-unknown-linux-gnueabi"
self.settings["CHOST"]="armv7r-unknown-linux-gnueabi"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7rl-unknown-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-r -mfpu=vfp -mfloat-abi=softfp"
retval = catalyst.spawn.spawn_bash("rsync -a --delete %s %s %s" % (extra_opts, src, dest))
delete_opts = "" if delete: delete_opts = "--delete" retval = catalyst.spawn.spawn_bash("rsync -a %s %s %s %s" % (delete_opts, extra_opts, src, dest))
def rsync(src, dest, delete=False, extra_opts=""): retval = catalyst.spawn.spawn_bash("rsync -a --delete %s %s %s" % (extra_opts, src, dest)) if retval != 0: raise CatalystError("Could not rsync '%s' to '%s'" % (src, dest))
self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfp -mfloat-abi=hardfp"
self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hardfp"
def __init__(self,myspec): generic_arm.__init__(self,myspec) self.settings["CHOST"]="armv7a-hardfloat-linux-gnueabi" self.settings["CFLAGS"]+=" -march=armv7-a -mfpu=vfp -mfloat-abi=hardfp"
"armv6t2" : arch_armv6t2,
def register(): "Inform main catalyst program of the contents of this plugin." return ({ "arm" : arch_arm, "armv4l" : arch_armv4l, "armv4tl": arch_armv4tl, "armv5tl": arch_armv5tl, "armv5tel": arch_armv5tel, "armv5tejl": arch_armv5tejl, "armv6j" : arch_armv6j, "armv6t2" : arch_armv6t2, "armv6z" : arch_armv6z, "armv6zk" : arch_armv6zk, "armv7a" : arch_armv7a, "armv7r" : arch_armv7r, "armv7m" : arch_armv7m, "armv7a_hardfp" : arch_armv7a_hardfp, "armeb" : arch_armeb, "armv5teb" : arch_armv5teb }, ("arm", "armv4l", "armv4tl", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
"armv7r" : arch_armv7r, "armv7m" : arch_armv7m,
def register(): "Inform main catalyst program of the contents of this plugin." return ({ "arm" : arch_arm, "armv4l" : arch_armv4l, "armv4tl": arch_armv4tl, "armv5tl": arch_armv5tl, "armv5tel": arch_armv5tel, "armv5tejl": arch_armv5tejl, "armv6j" : arch_armv6j, "armv6t2" : arch_armv6t2, "armv6z" : arch_armv6z, "armv6zk" : arch_armv6zk, "armv7a" : arch_armv7a, "armv7r" : arch_armv7r, "armv7m" : arch_armv7m, "armv7a_hardfp" : arch_armv7a_hardfp, "armeb" : arch_armeb, "armv5teb" : arch_armv5teb }, ("arm", "armv4l", "armv4tl", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
__albumfn = None
__file = None
def __stop_ignore(self, *args): self.__ignore = False self.disconnect(self.__sig)
cover = song.find_cover() self.__albumfn = cover and cover.name self.child.set_path(self.__albumfn)
self.__file = song.find_cover() self.child.set_path(self.__file and self.__file.name)
def set_song(self, activator, song): if not self.child: return if song: cover = song.find_cover() self.__albumfn = cover and cover.name self.child.set_path(self.__albumfn) else: self.child.set_path(None) self.__song = song
return bool(self.__albumfn)
return bool(self.__file)
def __nonzero__(self): return bool(self.__albumfn)
dest = join(dist_path, r'share\locales', locale, 'LC_MESSAGES')
dest = join(dist_path, r'share\locale', locale, 'LC_MESSAGES')
def do_setup(rev): PYVER='2.6' deps = [ (PythonDep('Python', PYVER), MSIInst('Python')), (OnePageDep('setuptools', None, 'http://pypi.python.org/pypi/setuptools', '[^"]*setuptools[^"]*tar.gz[^"#]*'), SetuptoolsInst()), (SFDep('gnuwin32', None, 'unrar-[1234567890.]*-bin.zip'), ZipInst('Python')), (SFDep('innounp', None, 'innounp[1234567890.]*.rar'), UnrarInst('Python')), (GnomeDep('libglade', '2.6', '[^"]*libglade_[^"]*win32.zip'), ZipInst('Python')), (GnomeDep('pycairo', '1.8', '[^"]*win32-py%s.exe' % PYVER), EasyInstallExeInst()), (GnomeDep('pygobject', '2.20', '[^"]*win32-py%s.exe' % PYVER), EasyInstallExeInst()), (GnomeDep('pygtk', '2.16', '[^"]*glade.win32-py%s.exe' % PYVER), EasyInstallExeInst()), (OnePageDep('GStreamer', None, 'http://www.gstreamer-winbuild.ylatuya.es/doku.php?id=download', '[^"]*GStreamerWinBuild-[1234567890.]*.exe'), InnoInst('gstreamer')), (OnePageDep('pygst', None, 'http://www.gstreamer-winbuild.ylatuya.es/doku.php?id=download', '[^"]*Pygst-[^"]*-Python%s[^"]*' % PYVER.replace('.', '')), InnoInst('Python')), (SFDep('py2exe', None, 'py2exe-[1234567890.]*.win32-py%s.exe' % PYVER), EasyInstallExeInst()), (SFDep('pywin32', None, 'pywin32-[1234567890.]*.win32-py%s.exe' % PYVER), EasyInstallExeInst()), (EasyInstallDep('mutagen'), EasyInstallInst()), (EasyInstallDep('feedparser'), EasyInstallInst()), (EasyInstallDep('python-musicbrainz2'), EasyInstallInst()), (GnomeDep('gtk+', '2.20', '[^"]*-bundle_.*_win32.zip'), ZipInst('Python')), #OnePageStep('NSIS', None, re='[^"]*nsis-[1234567890.]*-setup.exe[^"]*', # page='http://nsis.sourceforge.net/Download', args=['/S']), ] fmt = '%-20s %-15s %s' print print fmt % ('Package', 'Newest', 'Selected') for (dep, inst) in deps: print fmt % (dep.name, dep.versions[0], dep.filename) print 'Hit enter to continue...' raw_input() print '\nFetching unfetched dependencies...' for (dep, inst) in deps: if not dep.fetched: fn = join(CACHEDIR, dep.filename) with open(fn + '.tmp', 'wb') as fp: [fp.write(data) for data in urlfetch(dep.url)] os.rename(fn + '.tmp', fn) print '\nStarting installation...' new_paths = [join(TDIR, 'Python' + d) for d in ['', r'\bin', r'\scripts']] new_paths += [join(TDIR, 'gstreamer'), join(TDIR, r'gstreamer\bin')] print os.environ['PATH'] #subprocess.check_call(['path', ';'.join(new_paths + ['%PATH%'])]) os.environ['PATH'] = ';'.join(new_paths + [os.environ['PATH']]) print os.environ['PATH'] for (dep, inst) in deps: print 'Installing %s' % dep.name inst.install(dep) old_path = os.getcwd() repo_path = join(TDIR, 'ql') print 'Cloning this repo into temporary directory' ccall([HG_PATH, 'clone', '..', repo_path]) with chdir(join(repo_path, 'quodlibet')): print 'Updating to revision %s' % rev ccall([HG_PATH, 'pull']) ccall([HG_PATH, 'up', rev]) print 'Assembling Windows binary' ccall(['python', 'setup.py', 'py2exe']) dist_path = join(TDIR, r'ql\quodlibet\dist') # You must have a license to restribute the resulting installer #for file in ['Microsoft.VC90.CRT.manifest', 'msvcr90.dll']: # shutil.copy(join(TDIR, 'Python', file), dist_path) # Copy required files from GStreamer distribution gst_path = join(TDIR, 'gstreamer') for file in filter(lambda f: f.endswith('.dll'), os.listdir(join(gst_path, 'bin'))): if not os.path.isfile(join(dist_path, file)): shutil.copy(join(gst_path, 'bin', file), dist_path) for dir in ['lib', 'share', 'etc']: shutil.copytree(join(gst_path, dir), join(dist_path, dir)) # Unpack necessities from GTK+ bundle bundle = filter(lambda (d, i): d.name == 'gtk+', deps)[0][0] zf = zipfile.ZipFile(join(CACHEDIR, bundle.filename)) for item in zf.filelist: if (item.filename.startswith('lib') and item.filename.endswith('.dll')) or filter( item.filename.startswith, ['etc', 'share/locale', 'share/themes']): zf.extract(item, path=dist_path) elif item.filename.startswith('bin') and item.filename.endswith('dll'): dest = join(dist_path, os.path.basename(item.filename)) # This may not be necessary in Windows #with open(dest, 'w') as fp: # fp.write(zf.read(item)) built_locales = join(os.getcwd(), r'..\quodlibet\build\share\locale') # Prune GTK locales without a corresponding QL one: for locale in os.listdir(join(dist_path, r'share\locale')): if not os.path.isdir(join(built_locales, locale)): shutil.rmtree(join(dist_path, r'share\locale', locale)) # Copy over QL locales for locale in os.listdir(built_locales): dest = join(dist_path, r'share\locales', locale, 'LC_MESSAGES') if not os.path.isdir(dest): os.makedirs(dest) shutil.copy(join(built_locales, locale, r'LC_MESSAGES\quodlibet.mo'), dest) # Set the theme shutil.copy(join(dist_path, r'share\themes\MS-Windows\gtk-2.0\gtkrc'), join(dist_path, r'etc\gtk-2.0')) print "\n\nIf you have a license for redistributing the MSVC runtime," print "you should drop it in %s now." % join(TDIR, r'ql\quodlibet\dist') print "Otherwise just hit enter." raw_input() # Finally, run that installer script. subprocess.check_call([NSIS_PATH, join(TDIR, r'ql\junk\win_installer.nsi')]) shutil.copy(join(TDIR, r'ql\junk\quodlibet-LATEST.exe'), 'quodlibet-%s-installer.exe' % rev.replace('quodlibet-', ''))
class ReleaseEventComboBox(gtk.ComboBox):
class ReleaseEventComboBox(gtk.HBox):
def celldata(layout, cell, model, iter): release = model[iter][0] if not release: return date = release.getEarliestReleaseDate() if date: date = '%s, ' % date else: date = '' markup = "<b>%s</b>\n%s - %s%s tracks" % ( util.escape(release.title), util.escape(release.artist.name), date, release.tracksCount) cell.set_property('markup', markup)
super(ReleaseEventComboBox, self).__init__(self.model)
self.combo = gtk.ComboBox(self.model)
def __init__(self): self.model = gtk.ListStore(object, str) super(ReleaseEventComboBox, self).__init__(self.model) render = gtk.CellRendererText() self.pack_start(render) self.set_attributes(render, markup=1) self.set_sensitive(False)
self.pack_start(render) self.set_attributes(render, markup=1) self.set_sensitive(False)
self.combo.pack_start(render) self.combo.set_attributes(render, markup=1) self.combo.set_sensitive(False) self.label = gtk.Label("_Release:") self.label.set_use_underline(True) self.label.set_mnemonic_widget(self.combo) self.pack_start(self.label, expand=False) self.pack_start(self.combo)
def __init__(self): self.model = gtk.ListStore(object, str) super(ReleaseEventComboBox, self).__init__(self.model) render = gtk.CellRendererText() self.pack_start(render) self.set_attributes(render, markup=1) self.set_sensitive(False)
self.set_active(0) self.set_sensitive((len(events) > 0))
self.combo.set_active(0) self.combo.set_sensitive((len(events) > 0)) text = ngettext("%d _release:", "%d _releases:", len(events)) self.label.set_text(text % len(events)) self.label.set_use_underline(True)
def update(self, release): self.model.clear() events = release.getReleaseEvents() # The catalog number is the most important of these fields, as it's # the source for the 'labelid' tag, which we'll use until MB NGS is # up and running to deal with multi-disc albums properly. We sort to # find the earliest release with a catalog number. events.sort(key=lambda e: (bool(not e.getCatalogNumber()), e.getDate() or '9999-12-31')) for rel_event in events: text = '%s %s: <b>%s</b> <i>(%s)</i>' % ( rel_event.getDate() or '', rel_event.getLabel() or '', rel_event.getCatalogNumber(),rel_event.getCountry()) self.model.append( (rel_event, text) ) if len(events) > 0: self.set_active(0) self.set_sensitive((len(events) > 0))
itr = self.get_active_iter()
itr = self.combo.get_active_iter()
def get_release_event(self): itr = self.get_active_iter() if itr: return self.model[itr][0] else: return None
shared['date'] = album.getEarliestReleaseDate() or '' if shared['date'] and config_get('year_only', False): shared['date'] = shared['date'].split('-')[0]
def __save(self, widget=None, response=None): """Writes values to Song objects.""" self._qthread.stop() if response != gtk.RESPONSE_ACCEPT: self.destroy() return
relevt = self.release_combo.get_release_event()
def __save(self, widget=None, response=None): """Writes values to Song objects.""" self._qthread.stop() if response != gtk.RESPONSE_ACCEPT: self.destroy() return
if idx > len(album.tracks): continue
if idx >= len(album.tracks): continue
def __save(self, widget=None, response=None): """Writes values to Song objects.""" self._qthread.stop() if response != gtk.RESPONSE_ACCEPT: self.destroy() return
self.release_combo.set_sensitive(False) lbl = gtk.Label("_Release:") lbl.set_use_underline(True) lbl.set_mnemonic_widget(self.release_combo) hb.pack_start(lbl, expand=False) hb.pack_start(self.release_combo) vb.pack_start(hb, expand=False)
vb.pack_start(self.release_combo, expand=False)
def __init__(self, album, cache): self.album = album
def parse_url(self, url, post = {}, get = {}, enc = 'utf-8'):
def parse_url(self, url, post = {}, get = {}):
def parse_url(self, url, post = {}, get = {}, enc = 'utf-8'): """Will read the data and parse it into the data variable. A tag will be ['tagname', {all attributes}, 'data until the next tag'] Only starttags are handled/used."""
post_params = urllib.urlencode(post) get_params = urllib.urlencode(get) if get: get_params = '?' + get_params req = urllib2.urlopen('%s%s' % (url, get_params), post_params) text = req.read().decode(enc, 'replace')
text, self.encoding = get_url(url, post, get) text = text.decode(self.encoding, 'replace')
def parse_url(self, url, post = {}, get = {}, enc = 'utf-8'): """Will read the data and parse it into the data variable. A tag will be ['tagname', {all attributes}, 'data until the next tag'] Only starttags are handled/used."""
req.close()
def parse_url(self, url, post = {}, get = {}, enc = 'utf-8'): """Will read the data and parse it into the data variable. A tag will be ['tagname', {all attributes}, 'data until the next tag'] Only starttags are handled/used."""