rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
otitle_runtime = re.compile(r'<span class="gray">(.*?)</span>').findall(content) if otitle_runtime[0]: otitle_runtime = otitle_runtime[0].split(', ') otitle = ', '.join(otitle_runtime[:-1]) runtime = otitle_runtime[-1:][0]
otitle = re.compile(r'<span class="gray">(.*?)</span>').findall(content) if otitle[0]: otitle = otitle[0] runtime = None if otitle and otitle.find(', ') != -1: otitle_list = otitle.split(', ') otitle = ', '.join(otitle_list[:-1]) runtime = otitle_list[-1:][0]
def parse(self, object, content): ''' >>> m = Movie() >>> m.parse('link', u'<div class="element width_2"> \ <p class="pic"><a href="/level/1/film/179805/sr/1/"><img src="/images/sm_film/6505.jpg" alt="Title" title="Title" /></a></p> \ <div class="info"> \ <p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, ...
>>> movies = Movie.objects.search('Redacted') >>> len(movies) == 1 True >>> m = movies[0] >>> m.id 278229 >>> m.year 2007 >>> m.title u'\u0411\u0435\u0437 \u0446\u0435\u043d\u0437\u0443\u0440\u044b' >>> m.title_original u'Redacted' >>> m.plot u'\u0412 \u0446\u0435\u043d\u0442\u0440\u0435 \u043a\u0430\u0440\u0442\u0438\...
def get_posters(self): title = self.title.replace(' ', '-') if self.title else 'Title' return ['http://st3.kinopoisk.ru/im/poster/1/1/1/kinopoisk.ru-%s-%d.jpg' % (title, id) for id in self.posters]
content_results = content[content.find(u'<!-- результаты поиска -->'):content.find(u'<!-- /результаты поиска -->')]
content_results = content[content.find('<table cellspacing=0 cellpadding=0 width=100% border=0>'):content.find('<div style="margin-left: -20px">')]
def search(self, query): url, params = self.get_url_with_params(query) request = UrlRequest(url, params) content = request.read() # request is redirected to main page of objec if request.is_redirected: object = self.kinopoisk_object() object.parse('main_page', content) return [object] else: content_results = content[co...
>>> m.parse('link', u'<div class="element width_2"> \ <span class="gray"></span> \ </div>')
>>> m.parse('link', u'<div class="element width_2"><span class="gray"></span></div>')
def parse(self, object, content): ''' >>> m = Movie() >>> m.parse('link', u'<div class="element width_2"> \ <p class="pic"><a href="/level/1/film/179805/sr/1/"><img src="/images/sm_film/6505.jpg" alt="Title" title="Title" /></a></p> \ <div class="info"> \ <p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, ...
>>> m.parse('link', u'<div class="element width_2"> \ <span class="gray">Ultimate Taboo</span> \ </div>')
>>> m.parse('link', u'<div class="element width_2"><span class="gray">Zdar Buh, hosi!</span></div>')
def parse(self, object, content): ''' >>> m = Movie() >>> m.parse('link', u'<div class="element width_2"> \ <p class="pic"><a href="/level/1/film/179805/sr/1/"><img src="/images/sm_film/6505.jpg" alt="Title" title="Title" /></a></p> \ <div class="info"> \ <p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, ...
u'Ultimate Taboo'
u'Zdar Buh, hosi!'
def parse(self, object, content): ''' >>> m = Movie() >>> m.parse('link', u'<div class="element width_2"> \ <p class="pic"><a href="/level/1/film/179805/sr/1/"><img src="/images/sm_film/6505.jpg" alt="Title" title="Title" /></a></p> \ <div class="info"> \ <p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, ...
otitle = re.compile(r'<span class="gray">(.*?)</span>').findall(content)
otitle = re.compile(r'<span class="gray">([^<]*?)(?:, (\d+) [^<]+)?</span>').findall(content)
def parse(self, object, content): ''' >>> m = Movie() >>> m.parse('link', u'<div class="element width_2"> \ <p class="pic"><a href="/level/1/film/179805/sr/1/"><img src="/images/sm_film/6505.jpg" alt="Title" title="Title" /></a></p> \ <div class="info"> \ <p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, ...
otitle = otitle[0] runtime = None if otitle and otitle.find(', ') != -1: otitle_list = otitle.split(', ') otitle = ', '.join(otitle_list[:-1]) runtime = otitle_list[-1:][0] if otitle: object.title_original = self.prepare_str(otitle) if runtime: object.runtime = self.prepare_int(re.sub(r'^(\d+) .+$', r'\1', runtime))
if otitle[0][0]: object.title_original = self.prepare_str(otitle[0][0]) if otitle[0][1]: object.runtime = self.prepare_int(otitle[0][1])
def parse(self, object, content): ''' >>> m = Movie() >>> m.parse('link', u'<div class="element width_2"> \ <p class="pic"><a href="/level/1/film/179805/sr/1/"><img src="/images/sm_film/6505.jpg" alt="Title" title="Title" /></a></p> \ <div class="info"> \ <p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, ...
<p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, <span class="year"><a href="/level/10/m_act[year]/1952/">1952</a></span></p> \
<p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, <span class="year">1952</span></p> \
def parse(self, object, content): ''' >>> m = Movie() >>> m.parse('link', u'<div class="element width_2"> \ <p class="pic"><a href="/level/1/film/179805/sr/1/"><img src="/images/sm_film/6505.jpg" alt="Title" title="Title" /></a></p> \ <div class="info"> \ <p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, ...
year = re.compile(r'<a href="/level/10/m_act\[year\]/(\d{4})/"').findall(content)
year = re.compile(r'<span class="year">(\d{4})</span>').findall(content)
def parse(self, object, content): ''' >>> m = Movie() >>> m.parse('link', u'<div class="element width_2"> \ <p class="pic"><a href="/level/1/film/179805/sr/1/"><img src="/images/sm_film/6505.jpg" alt="Title" title="Title" /></a></p> \ <div class="info"> \ <p class="name"><a href="/level/1/film/179805/sr/1/">Title</a>, ...
ignores_i = anythnig("Which factoid requets should the bot always ignore?", default=', '.join(Encyclopedia.ignores._default)) for name in re.split(r',?\s', +ignore_i):
ignores_i = anything("Which factoid requets should the bot always ignore?", default=', '.join(Encyclopedia.ignores._default)) for name in re.split(r',?\s', ignores_i):
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
curStabel = something("What is short name of the current stable release?", default=Encyclopedia.curStable._default)
curStable = something("What is short name of the current stable release?", default=Encyclopedia.curStable._default)
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
curLTSong = something("What is long name of the current LTS release?", default=Encyclopedia.curLTSLoong._default)
curLTSLong = something("What is long name of the current LTS release?", default=Encyclopedia.curLTSLong._default)
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
curStabel = Encyclopedia.curStable._default
curStable = Encyclopedia.curStable._default
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
con.begin()
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default)
def __init__(self, function, timeout=MAX_TIMEOUT):
def __init__(self, function, timeout=CON_TIMEOUT):
def __init__(self, function, timeout=MAX_TIMEOUT):
self.log.debug("Connection to the server failed/other error:%s" %sys.exc_info())
self.log.debug("Connection to the server failed/other error:%s",sys.exc_info())
def _connect(self, server, proxy): try: if proxy: self.log.debug("Trying proxied connection... (%r)"% proxy) self.proxied_transport = ProxiedTransport() self.proxied_transport.set_proxy(proxy) self.xmlrpc_server = ServerProxy(server, transport=self.proxied_transport, allow_none=True) #self.ServerInfo() self.log.debug("...
login = TimeoutFunction(self._login) try:
try: login = TimeoutFunction(self._login)
def login(self, username="", password=""): login = TimeoutFunction(self._login) try: return login(username, password) except TimeoutFunctionException: self.log.error("login timed out")
self.log.debug("Login ended in %s with status: %s"% (info['seconds'], info['status']))
self._token = None return False
def _login(self, username="", password=""): """Login to the Server using username/password, empty parameters means an anonymously login Returns True if login sucessful, and False if not. """ self.log.debug("----------------") self.log.debug("Logging in (username: %s)..."% username)
logout = TimeoutFunction(self._logout) try:
try: logout = TimeoutFunction(self._logout)
def logout(self): logout = TimeoutFunction(self._logout) try: return logout() except TimeoutFunctionException: self.log.error("logout timed out")
info = self.xmlrpc_server.LogOut(self._token) self.log.debug("Logout ended in %s with status: %s"% (info['seconds'], info['status'])) self._token = None
try: info = self.xmlrpc_server.LogOut(self._token) self.log.debug("Logout ended in %s with status: %s"% (info['seconds'], info['status'])) except xmlrpclib.ProtocolError, e: self.log.debug("error in HTTP/HTTPS transport layer") raise e except xmlrpclib.Fault, e: self.log.debug("error in xml-rpc server") raise e except:...
def _logout(self): """Logout from current session(token) This functions doesn't return any boolean value, since it can 'fail' for anonymous logins """ self.log.debug("Logging out from session ID: %s"% self._token) info = self.xmlrpc_server.LogOut(self._token) self.log.debug("Logout ended in %s with status: %s"% (info['...
info = self.xmlrpc_server.GetSubLanguages(language) self.log.debug("GetSubLanguages complete in %s"% info['seconds']) if language: for lang in info['data']: if lang['ISO639'] == language: return lang['SubLanguageID'] return info['data']
try: info = self.xmlrpc_server.GetSubLanguages(language) self.log.debug("GetSubLanguages complete in %s"% info['seconds']) if language: for lang in info['data']: if lang['ISO639'] == language: return lang['SubLanguageID'] return info['data'] except xmlrpclib.ProtocolError, e: self.log.debug("error in HTTP/HTTPS transpo...
def _GetSubLanguages(self, language): """Return all suported subtitles languages in a dictionary If language var is set, returns SubLanguageID for it """ self.log.debug("----------------") self.log.debug("GetSubLanguages RPC method starting...") if language == "all": # return result right away if no 'translation' neede...
info = self.xmlrpc_server.CheckSubHash(self._token,hashes) self.log.debug("CheckSubHash ended in %s with status: %s"% (info['seconds'], info['status'])) result = {} for hash in hashes: result[hash] = info['data'][hash] return result
try: info = self.xmlrpc_server.CheckSubHash(self._token,hashes) self.log.debug("CheckSubHash ended in %s with status: %s"% (info['seconds'], info['status'])) result = {} for hash in hashes: result[hash] = info['data'][hash] return result except xmlrpclib.ProtocolError, e: self.log.debug("error in HTTP/HTTPS transport...
def _CheckSubHash(self, hashes): """ @hashes = list of subtitle hashes or video object returns: dictionary like { hash: subID } This method returns !IDSubtitleFile, if Subtitle Hash exists. If not exists, it returns '0'. """ self.log.debug("----------------") self.log.debug("CheckSubHash RPC method starting...") if isi...
answer = self.xmlrpc_server.DownloadSubtitles(self._token, subtitles_to_download.keys()) self.log.debug("DownloadSubtitles finished in %s with status %s."% (answer['seconds'], answer['status'])) if answer.has_key("data"): if answer['data'] == False: self.log.info("Error downloading subtitle.")
try: answer = self.xmlrpc_server.DownloadSubtitles(self._token, subtitles_to_download.keys()) self.log.debug("DownloadSubtitles finished in %s with status %s."% (answer['seconds'], answer['status'])) except xmlrpclib.ProtocolError, e: self.log.debug("error in HTTP/HTTPS transport layer") raise e except xmlrpclib.Fault,...
def _DownloadSubtitles(self, subtitles): #TODO: decide wheter this should save the subtitle (as it does atm) or just return the encoded data #Note ivan: in my GUI before I replace the file I'll show a confirmation code """ Download subtitles by there id's @subtitles: dictionary with subtitle id's and their path - { id...
self.log.debug("Got %i subtitles from server. Uncompressing data..."% len(answer['data'])) for sub in answer['data']: self.BaseToFile(sub['data'], subtitles_to_download[sub['idsubtitlefile']]) return answer['data'] else: self.log.info("Server sent no subtitles to me.") return False
def _DownloadSubtitles(self, subtitles): #TODO: decide wheter this should save the subtitle (as it does atm) or just return the encoded data #Note ivan: in my GUI before I replace the file I'll show a confirmation code """ Download subtitles by there id's @subtitles: dictionary with subtitle id's and their path - { id...
info = self.xmlrpc_server.CheckSoftwareUpdates(app) self.log.debug("Latest SubDownloader Version Found: %s"% info['latest_version']) return info
try: info = self.xmlrpc_server.CheckSoftwareUpdates(app) except xmlrpclib.ProtocolError, e: self.log.debug("error in HTTP/HTTPS transport layer") raise e except xmlrpclib.Fault, e: self.log.debug("error in xml-rpc server") raise e except Exception,e: self.log.debug("Connection to the server failed/other error:%s",sys.e...
def _CheckSoftwareUpdates(self, app=None): """Returns latest info on the given application if available """ self.log.debug("----------------") self.log.debug("CheckSoftwareUpdates RPC method starting...") if not app: app = APP_TITLE.lower() info = self.xmlrpc_server.CheckSoftwareUpdates(app)
NoOperation = TimeoutFunction(self._NoOperation) try:
try: NoOperation = TimeoutFunction(self._NoOperation)
def NoOperation(self, token=None): NoOperation = TimeoutFunction(self._NoOperation) try: return NoOperation() except TimeoutFunctionException: self.log.error("NoOperation timed out")
info = self.xmlrpc_server.NoOperation(self._token) self.log.debug("NoOperation finished in %s with status %s."% (info['seconds'], info['status'])) self.log.debug("----------------") if info['status'] != "200 OK": return False return True
noop=False try: info = self.xmlrpc_server.NoOperation(self._token) self.log.debug("NoOperation finished in %s with status %s."% (info['seconds'], info['status'])) self.log.debug("----------------") if info['status'] == "200 OK": return True else: return noop except xmlrpclib.ProtocolError, e: self.log.debug("error in H...
def _NoOperation(self): """This method should be called every 15 minutes after last request to xmlrpc. It's used to keep current session alive. Returns True if current session token is valid and False if not. """ self.log.debug("----------------") self.log.debug("NoOperation RPC method starting...") info = self.xmlrpc_...
info = self.xmlrpc_server.SearchToMail(self._token, languages, video_array) self.log.debug("SearchToMail finished in %s with status %s."% (info['seconds'], info['status']))
try: info = self.xmlrpc_server.SearchToMail(self._token, languages, video_array) self.log.debug("SearchToMail finished in %s with status %s."% (info['seconds'], info['status'])) except xmlrpclib.ProtocolError, e: self.log.debug("error in HTTP/HTTPS transport layer") raise e except xmlrpclib.Fault, e: self.log.debug("er...
def _SearchToMail(self, videos, languages): """Register user email to be noticed when given video subtitles are available to download @videos: video objects - list @languages: language id codes - list """ self.log.debug("----------------") self.log.debug("SearchToMail RPC method starting...") video_array = [] for video...
print(' File "$DIST_DIR\\luaui.lua"')
print(' File "${DIST_DIR}\\luaui.lua"')
print('!ifdef INSTALL')
print(' File "$DIST_DIR\\' + osName(d) + osName(f) + '"')
print(' File "${DIST_DIR}\\' + osName(d) + osName(f) + '"')
print('!ifdef INSTALL')
addr2line = Popen([ADDR2LINE, '-e', tempfile.name], stdin = PIPE, stdout = PIPE, stderr = PIPE)
addr2line = Popen([ADDR2LINE, '-j', '.text', '-e', tempfile.name], stdin = PIPE, stdout = PIPE, stderr = PIPE)
def translate_module_addresses(module, debugfile, addresses): '''\ Translate addresses in a module to (module, address, filename, lineno) tuples by invoking addr2line exactly once on the debugging symbols for that module. ''' with NamedTemporaryFile() as tempfile: log.info('\tExtracting debug symbols for module %s from...
distDirCandidates = [sys.argv[1], 'dist', 'game', 'cont']
if len(sys.argv) > 1: baseDir = sys.argv[1] else: baseDir = os.path.join(sys.path[0], '..') distDirCandidates = ['dist', 'game', 'cont'] luaUIDir = 'LuaUI' distBase = '${DIST_DIR}' instBase = '${INSTDIR}' os.chdir(sys.path[0]) os.chdir('..')
# !ifdef INSTALL
os.chdir(distDir)
os.chdir(os.path.join(distDir, luaUIDir))
# !ifdef INSTALL
distDir = os.path.join('..', distDir) try: os.chdir(distDir) break except OSError: distDir = "" continue
distDir = ""
# !ifdef INSTALL
sys.exit(1); top = 'LuaUI/'
sys.exit(1) else: os.chdir(os.path.join(baseDir, distDir))
# !ifdef INSTALL
dirs[path] = [] filelist = os.listdir(path) for f in filelist: fullname = path + f if os.path.isdir(fullname): if (f != 'Config') and (f != '.git'): fullname = fullname + '/' GetDirs(fullname, dirs) else: dirs[path].append(f)
dirs[path] = [] filelist = os.listdir(path) for f in filelist: fullname = os.path.join(path, f) if os.path.isdir(fullname): if (f != 'Config') and (f != '.git'): GetDirs(fullname, dirs) else: dirs[path].append(f)
def GetDirs(path, dirs): dirs[path] = [] filelist = os.listdir(path) for f in filelist: fullname = path + f if os.path.isdir(fullname): if (f != 'Config') and (f != '.git'): fullname = fullname + '/' GetDirs(fullname, dirs) else: dirs[path].append(f)
def osName(path): return path.replace('/', '\\')
def toWinPath(path): return path.replace('/', '\\')
def osName(path): return path.replace('/', '\\')
GetDirs(top, dirs)
GetDirs(luaUIDir, dirs)
def osName(path): return path.replace('/', '\\')
print(' SetOutPath "$INSTDIR"') print(' File "${DIST_DIR}\\luaui.lua"')
print(' ; Purge old file from 0.75 install.') print(' Delete "' + instBase + '\LuaUI\unitdefs.lua"') print('') print(' SetOutPath "' + instBase + '"') print(' File "' + toWinPath(os.path.join(distBase, distDir, 'luaui.lua')) + '"')
print('!ifdef INSTALL')
print(' SetOutPath "$INSTDIR\\' + osName(d) + '"') for f in dirs[d]: print(' File "${DIST_DIR}\\' + osName(d) + osName(f) + '"')
print(' SetOutPath "' + toWinPath(os.path.join(instBase, d)) + '"') for f in dirs[d]: print(' File "' + toWinPath(os.path.join(distBase, distDir, d, f)) + '"')
print('!ifdef INSTALL')
print(' Delete "$INSTDIR\\luaui.lua"')
print(' Delete "' + toWinPath(os.path.join(instBase, 'luaui.lua')) + '"')
print('!ifdef INSTALL')
for f in dirs[d]: print(' Delete "$INSTDIR\\' + osName(d) + osName(f) + '"') print(' RmDir "$INSTDIR\\' + osName(d) + '"')
for f in dirs[d]: print(' Delete "' + toWinPath(os.path.join(instBase, d, f)) + '"') print(' RmDir "' + toWinPath(os.path.join(instBase, d)) + '"')
print('!ifdef INSTALL')
print(' RmDir "$INSTDIR\\LuaUI"')
print(' RmDir "' + toWinPath(os.path.join(instBase, luaUIDir)) + '"')
print('!ifdef INSTALL')
instBase = '${INSTDIR}'
instBase = '$INSTDIR'
# !ifdef INSTALL
def common_suffix_length(a, b): '''\ Compute the length of the common suffix of a and b, considering / and \ equal. >>> common_suffix_length('/foo/bar/baz', '\\\\other\\\\bar\\\\baz') 8 >>> common_suffix_length('bar', 'foo/bar') 3 >>> common_suffix_length('bar', 'bar') 3 ''' a = a.replace('\\', '/') b = b.replace('\\'...
def common_suffix_length(a, b): '''\ Compute the length of the common suffix of a and b, considering / and \ equal. >>> common_suffix_length('/foo/bar/baz', '\\\\other\\\\bar\\\\baz') 8 >>> common_suffix_length('bar', 'foo/bar') 3 >>> common_suffix_length('bar', 'bar') 3 ''' a = a.replace('\\', '/') b = b.replace('\\'...
Unfortunately if the correct module isn't available the closest match can be wrong: >>> best_matching_module('c:/Program Files/Spring/AI/Skirmish/UnknownAI/SkirmishAI.dll', modules)
>>> best_matching_module('c:/Spring/NullAI/0.0.1/SkirmishAI.dll', modules)
def best_matching_module(needle, haystack): '''\ Choose the best matching module, based on longest common suffix. This way it ignores the install location of Spring: >>> modules = ['spring.exe', 'AI/Skirmish/NullAI/SkirmishAI.dll'] >>> best_matching_module('c:/Program Files/Spring/spring.exe', modules) 'spring.exe' ...
''' longest_csl = 0 best_match = None
If the correct module isn't available nothing is returned: >>> best_matching_module('c:/Program Files/Spring/AI/Skirmish/UnknownAI/0.0.1/SkirmishAI.dll', modules) ''' parts = needle.replace('\\', '/').split('/') if parts[-1] == 'SkirmishAI.dll': needle = '%s/SkirmishAI.dll' % parts[-3] else: needle = parts[-1] log.de...
def best_matching_module(needle, haystack): '''\ Choose the best matching module, based on longest common suffix. This way it ignores the install location of Spring: >>> modules = ['spring.exe', 'AI/Skirmish/NullAI/SkirmishAI.dll'] >>> best_matching_module('c:/Program Files/Spring/spring.exe', modules) 'spring.exe' ...
csl = common_suffix_length(needle, module) if csl > longest_csl: longest_csl = csl best_match = module return best_match
if module.endswith(needle): log.debug('best_matching_module: found %s', module) return module log.debug('best_matching_module: module not found') return None
def best_matching_module(needle, haystack): '''\ Choose the best matching module, based on longest common suffix. This way it ignores the install location of Spring: >>> modules = ['spring.exe', 'AI/Skirmish/NullAI/SkirmishAI.dll'] >>> best_matching_module('c:/Program Files/Spring/spring.exe', modules) 'spring.exe' ...
addr2line = Popen([ADDR2LINE, '-j', '.text', '-e', tempfile.name], stdin = PIPE, stdout = PIPE, stderr = PIPE)
cmd = [ADDR2LINE, '-j', '.text', '-e', tempfile.name] log.debug('\tCommand line: ' + ' '.join(cmd)) addr2line = Popen(cmd, stdin = PIPE, stdout = PIPE, stderr = PIPE)
def translate_module_addresses(module, debugfile, addresses): '''\ Translate addresses in a module to (module, address, filename, lineno) tuples by invoking addr2line exactly once on the debugging symbols for that module. ''' with NamedTemporaryFile() as tempfile: log.info('\tExtracting debug symbols for module %s from...
log.setLevel(logging.INFO)
log.setLevel(logging.DEBUG)
def run_xmlrpc_server(): '''Run an XMLRPC server that publishes the translate_stacktrace function.''' from DocXMLRPCServer import DocXMLRPCServer as XMLRPCServer logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s') with open(PIDFILE, 'w') as pidfile: pidfile.write('%s' % os.getpid()) try: # Create...
match = RE_VERSION_DETAILS.match(version)
match = RE_VERSION_DETAILS.match(version + ' ')
def detect_version_details(infolog): '''\ Detect config, branch, rev from version string(s) in infolog. >>> detect_version_details('Spring 0.81+.0.0 (0.81.2.1-1059-g7937d00) has crashed.') ('default', 'master', '0.81.2.1-1059-g7937d00') >>> detect_version_details('Hang detection triggered for Spring 0.81+.0.0 ([debug...
d += [Dependency(['openal', 'openal32', 'OpenAL32'], ['AL/al.h'])]
d += [Dependency(['openal', 'openal32', 'OpenAL32', 'soft_oal'], ['AL/al.h'])]
def CheckHeadersAndLibraries(env, conf): print "\nChecking headers and libraries" boost_common = Dependency([], ['boost/cstdint.hpp']) boost_thread = Dependency(['boost_thread'], ['boost/thread.hpp']) boost_regex = Dependency(['boost_regex'], ['boost/regex.hpp']) boost_serial = Dependency([], ['boost/serialization/...
print(' File "' + toWinPath(os.path.join(distBase, distDir, 'luaui.lua')) + '"')
print(' File "' + toWinPath(os.path.join(distBase, 'luaui.lua')) + '"')
print('!ifdef INSTALL')
print(' File "' + toWinPath(os.path.join(distBase, distDir, d, f)) + '"')
print(' File "' + toWinPath(os.path.join(distBase, d, f)) + '"')
print('!ifdef INSTALL')
import os
import os, sys
# !ifdef INSTALL
try: os.chdir('dist') except OSError: os.chdir('../dist')
distDirCandidates = [sys.argv[1], 'dist', 'game', 'cont'] distDir = "" for d in distDirCandidates: distDir = d try: os.chdir(distDir) break except OSError: distDir = os.path.join('..', distDir) try: os.chdir(distDir) break except OSError: distDir = "" continue if distDir == "": sys.exit(1);
# !ifdef INSTALL
if (f != 'Config') and (f != '.svn'):
if (f != 'Config') and (f != '.git'):
def GetDirs(path, dirs): dirs[path] = [] filelist = os.listdir(path) for f in filelist: fullname = path + f if os.path.isdir(fullname): if (f != 'Config') and (f != '.svn'): fullname = fullname + '/' GetDirs(fullname, dirs) else: dirs[path].append(f)
print(' File "..\\dist\\luaui.lua"')
print(' File "$DIST_DIR\\luaui.lua"')
print('!ifdef INSTALL')
print(' File "..\\dist\\' + osName(d) + osName(f) + '"')
print(' File "$DIST_DIR\\' + osName(d) + osName(f) + '"')
print('!ifdef INSTALL')
color = (npair[0] < len(DEV_NAME_COLORS) and DEV_NAME_COLORS[ npair[0] ]) or "F00F00" nname = npair[1] nline = (LOG_LINE_PREFIX % (color, nname)) + line[match.span()[1]: ] + '\n'
color = (npair[0] < len(DEV_NAME_COLORS) and DEV_NAME_COLORS[npair[0]]) or "F00F00" nline = (LOG_LINE_PREFIX % (color, "<" + npair[1] + ">")) + line[match.span()[1]: ] + '\n'
def ProcessLines(lines): random.shuffle(DEV_NAME_COLORS) nlines = "" onames = {} for line in lines: match = re.search(DEV_NAME_PATTERN, line) if (match == None): continue oname = match.group(0) oname = oname[1: -1] if (not onames.has_key(oname)): nname = oname for n in DEV_NAME_LIST: if (oname.find(n) >= 0): nnam...
return nlines
gmtime = time.gmtime() pcolor = "000000" prefix += "%s: %d-%d-%d\n" % (((LOG_LINE_PREFIX % (pcolor, "Date")), gmtime[2], gmtime[1], gmtime[0])) prefix += "%s: " % (LOG_LINE_PREFIX % (pcolor, "Present")) knames = onames.keys() for k in xrange(len(knames)): oname = knames[k] npair = onames[oname] color = DEV_NAME_COLORS...
def ProcessLines(lines): random.shuffle(DEV_NAME_COLORS) nlines = "" onames = {} for line in lines: match = re.search(DEV_NAME_PATTERN, line) if (match == None): continue oname = match.group(0) oname = oname[1: -1] if (not onames.has_key(oname)): nname = oname for n in DEV_NAME_LIST: if (oname.find(n) >= 0): nnam...
ntracks = 20
ntracks = 100
def testCaching( self ):
l = 100
l = 10
def testPValueComputation( self ): annotation_size = 100 workspace_size = 1000 segment_size = 10
samples = [0] * y + [1] * (l - y)
samples = [1] * y + [0] * (l - y)
def testPValueComputation( self ): annotation_size = 100 workspace_size = 1000 segment_size = 10
self.assert_( fpr >= g.pvalue, "fdr (%f) != pvalue (%f): y=%i, x=%i, s=%i, t=%i" % \
self.assert_( fpr >= g.pvalue - 0.0001, "fpr (%f) != pvalue (%f): y=%i, x=%i, s=%i, t=%i" % \
def testPValueComputation( self ): annotation_size = 100 workspace_size = 1000 segment_size = 10
self.assert_( r.qvalue > 0.5 )
self.assert_( r.qvalue > 0.5, "%f" % r.qvalue )
def testStats( self ): annotation_size = 100 workspace_size = 1000 segment_size = 10
dumpStats( segments, "stats_segments_raw" )
dumpStats( segments, "stats_segments_normed" )
def dumpStats( coll, section ): if section in options.output_stats or "all" in options.output_stats: coll.outputStats( E.openOutputFile( section ) )
help="filename with segments. Also accepts a glob in parantheses [default=%default]." )
help="filename with segments. Also accepts a glob in parentheses [default=%default]." )
def main( argv = None ): """script main. parses command line options in sys.argv, unless *argv* is given. """ if not argv: argv = sys.argv # setup command line parser parser = optparse.OptionParser( version = "%prog version: $Id: script_template.py 2871 2010-03-03 10:20:44Z andreas $", usage = globals()["__doc__"] )...
help="filename with workspace segments. Also accepts a glob in parantheses [default=%default]." )
help="filename with workspace segments. Also accepts a glob in parentheses [default=%default]." )
def main( argv = None ): """script main. parses command line options in sys.argv, unless *argv* is given. """ if not argv: argv = sys.argv # setup command line parser parser = optparse.OptionParser( version = "%prog version: $Id: script_template.py 2871 2010-03-03 10:20:44Z andreas $", usage = globals()["__doc__"] )...
help="filename with isochore segments. Also accepts a glob in parantheses [default=%default]." )
help="filename with isochore segments. Also accepts a glob in parentheses [default=%default]." )
def main( argv = None ): """script main. parses command line options in sys.argv, unless *argv* is given. """ if not argv: argv = sys.argv # setup command line parser parser = optparse.OptionParser( version = "%prog version: $Id: script_template.py 2871 2010-03-03 10:20:44Z andreas $", usage = globals()["__doc__"] )...
outfile = sys.stdout
outfile = options.stdout
def main( argv = None ): """script main. parses command line options in sys.argv, unless *argv* is given. """ if not argv: argv = sys.argv # setup command line parser parser = optparse.OptionParser( version = "%prog version: $Id: script_template.py 2871 2010-03-03 10:20:44Z andreas $", usage = globals()["__doc__"] )...
os.system("update-locale LANG=\"%s\"" % self.locale)
os.system("update-locale LANG=\"%s.UTF-8\"" % self.locale)
def install(self):
path = self.device_node device = parted.getDevice(path) disk = parted.Disk(device) partition = disk.getFirstPartition() last_added_partition = Partition(partition) partitions.append(last_added_partition) partition = partition.nextPartition() while (partition is not None): if last_added_partition.partition.number == -1 ...
try: path = self.device_node device = parted.getDevice(path) disk = parted.Disk(device) partition = disk.getFirstPartition() last_added_partition = Partition(partition) partitions.append(last_added_partition)
def build_partitions(self): gtk.gdk.threads_enter() self.window.set_sensitive(False) # "busy" cursor. cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) self.window.window.set_cursor(cursor) from progress import ProgressDialog dialog = ProgressDialog() dialog.show(title=_("Installer"), label=_("Scanning disk %s for partitions") % ...
out = open("/tmp/install_grub.sh", "w") out.write(" out.write("mount --bind /dev/ /target/dev\n") out.write("mount --bind /dev/pts /target/dev/shm\n") out.write("mount --bind /dev/shm /target/dev/shm\n") out.write("mount --bind /proc /target/proc\n") out.write("mount --bind /sys /target/sys\n") out.write("chroot /targe...
os.system("chroot /target/ /bin/sh -c \"grub-install %s\"" % self.grub_device) os.system("chroot /target/ /bin/sh -c \"grub-mkconfig -o /boot/grub/grub.cfg\"").
def install(self):
self.run_in_chroot("useradd -s %s -c \"%s\" -G sudo -m %s" % ("/bin/bash", user.realname, user.username))
self.run_in_chroot("useradd -s %s -c \'%s\' -G sudo -m %s" % ("/bin/bash", user.realname, user.username))
def install(self): ''' Install this baby to disk ''' # mount the media location. print " --> Installation started" try: if(not os.path.exists("/target")): os.mkdir("/target") if(not os.path.exists("/source")): os.mkdir("/source") # find the squashfs.. root = self.media root_type = self.media_type if(not os.path.exists(...
self.style.apply_default_background(self.window, True, gtk.STATE_NORMAL, None, 0, 0, width, height) cr.set_source_rgba(0, 0, 0, 0.0)
def draw(self, cr, width, height): #self.style.apply_default_background(self.window, True, gtk.STATE_NORMAL, None, 0, 0, width, height) #cr.set_source_rgba(0, 0, 0, 0.0) self.width = width # for add_label self.height = height # for add_label height /= 2 width -= 40 #cr.rectangle(0, 0, width, height) #cr.fill()
cr.rectangle(0, 0, width, height) cr.fill()
def draw(self, cr, width, height): #self.style.apply_default_background(self.window, True, gtk.STATE_NORMAL, None, 0, 0, width, height) #cr.set_source_rgba(0, 0, 0, 0.0) self.width = width # for add_label self.height = height # for add_label height /= 2 width -= 40 #cr.rectangle(0, 0, width, height) #cr.fill()
if partition.partition.number == -1: border_color = (0.6, 0.6, 0.6) fill_color = (0.2, 0.2, 0.6) else: border_color = self.colors[partition.partition.number % len(self.colors)] fill_color = (0.9, 0.9, 0.9)
if partition.size > 0.5: if partition.partition.number == -1: border_color = (0.6, 0.6, 0.6) fill_color = (0.6, 0.6, 0.6) else: border_color = self.colors[partition.partition.number % len(self.colors)] fill_color = (0.9, 0.9, 0.9)
def draw(self, cr, width, height): #self.style.apply_default_background(self.window, True, gtk.STATE_NORMAL, None, 0, 0, width, height) #cr.set_source_rgba(0, 0, 0, 0.0) self.width = width # for add_label self.height = height # for add_label height /= 2 width -= 40 #cr.rectangle(0, 0, width, height) #cr.fill()
self.window.resize(width, height) self.window.realize()
def __init__(self): self.resource_dir = '/usr/share/live-installer/' #self.glade = 'interface.glade' self.glade = os.path.join(self.resource_dir, 'interface.glade') self.wTree = gtk.glade.XML(self.glade, 'main_window')
self.window.set_title(DISTRIBUTION_NAME + " " + _("Installer"))
if "--debug" in sys.argv: self.window.set_title((_("%s Installer") % DISTRIBUTION_NAME) + " (debug)") else: self.window.set_title(_("%s Installer") % DISTRIBUTION_NAME)
def __init__(self): self.resource_dir = '/usr/share/live-installer/' #self.glade = 'interface.glade' self.glade = os.path.join(self.resource_dir, 'interface.glade') self.wTree = gtk.glade.XML(self.glade, 'main_window')
pro = subprocess.Popen("parted -lms", stdout=subprocess.PIPE, shell=True) last_name = "" for line in pro.stdout: line = line.rstrip("\r\n") if ":" in line: split = line.split(":") if(len(split) <= 3): continue if(line.startswith("/dev")): last_name = split[0] model2.append([last_name]) continue sections = line.split("...
if "--debug" in sys.argv: model.append(["/dev/debug", "debug", False, None, 0, True]) else: pro = subprocess.Popen("parted -lms", stdout=subprocess.PIPE, shell=True) last_name = "" for line in pro.stdout: line = line.rstrip("\r\n") if ":" in line: split = line.split(":") if(len(split) <= 3): continue if(line.startswith...
def build_disk_list(self): model = gtk.ListStore(str,str,bool,str,str,bool) model2 = gtk.ListStore(str) pro = subprocess.Popen("parted -lms", stdout=subprocess.PIPE, shell=True) last_name = "" for line in pro.stdout: line = line.rstrip("\r\n") if ":" in line: split = line.split(":") if(len(split) <= 3): continue if(lin...
else: model.append([device, filesystem, False, None, size_, False]) print "%s - %s" % (device, filesystem)
print "%s - %s" % (device, filesystem)
def build_disk_list(self): model = gtk.ListStore(str,str,bool,str,str,bool) model2 = gtk.ListStore(str) pro = subprocess.Popen("parted -lms", stdout=subprocess.PIPE, shell=True) last_name = "" for line in pro.stdout: line = line.rstrip("\r\n") if ":" in line: split = line.split(":") if(len(split) <= 3): continue if(lin...
sys.exit(0)
def do_install(self): ''' Actually perform the installation .. ''' inst = self.installer # Create fstab files = fstab() model = self.wTree.get_widget("treeview_disks").get_model() for row in model: if(row[2] or row[3] is not None): # format or mountpoint specified. files.add_mount(device=row[0], mountpoint=row[3], fil...
self.run_in_chroot("echo \"
os.system("echo \"
def install(self): ''' Install this baby to disk ''' # mount the media location. try: if(not os.path.exists("/target")): os.mkdir("/target") if(not os.path.exists("/source")): os.mkdir("/source") # find the squashfs.. root = self.media root_type = self.media_type if(not os.path.exists(root)): print _("Base filesystem d...
self.run_in_chroot("echo \"%s.UTF-8 UTF-8\" >> /etc/locale.gen" % self.locale)
os.system("echo \"%s.UTF-8 UTF-8\" >> /target/etc/locale.gen" % self.locale)
def install(self): ''' Install this baby to disk ''' # mount the media location. try: if(not os.path.exists("/target")): os.mkdir("/target") if(not os.path.exists("/source")): os.mkdir("/source") # find the squashfs.. root = self.media root_type = self.media_type if(not os.path.exists(root)): print _("Base filesystem d...
self.run_in_chroot("echo \"\" > /etc/default/locale")
os.system("echo \"\" > /target/etc/default/locale")
def install(self): ''' Install this baby to disk ''' # mount the media location. try: if(not os.path.exists("/target")): os.mkdir("/target") if(not os.path.exists("/source")): os.mkdir("/source") # find the squashfs.. root = self.media root_type = self.media_type if(not os.path.exists(root)): print _("Base filesystem d...
self.run_in_chroot("echo \"%s\" > /etc/timezone" % self.timezone_code) self.run_in_chroot("cp /usr/share/zoneinfo/%s /etc/localtime" % self.timezone)
os.system("echo \"%s\" > /target/etc/timezone" % self.timezone_code) os.system("cp /target/usr/share/zoneinfo/%s /target/etc/localtime" % self.timezone)
def install(self): ''' Install this baby to disk ''' # mount the media location. try: if(not os.path.exists("/target")): os.mkdir("/target") if(not os.path.exists("/source")): os.mkdir("/source") # find the squashfs.. root = self.media root_type = self.media_type if(not os.path.exists(root)): print _("Base filesystem d...
self.window.window.set_cursor(cursor) gtk.gdk.threads_leave()
self.window.window.set_cursor(cursor)
def build_partitions(self): gtk.gdk.threads_enter() self.window.set_sensitive(False) # "busy" cursor. cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) self.window.window.set_cursor(cursor) gtk.gdk.threads_leave() from progress import ProgressDialog dialog = ProgressDialog() dialog.show(title=_("Installer"), label=_("Scanning dis...
section = line.split(":")[2].strip(" ") if("/dev/" in section): device = section.split(" ")[0].replace(" ","") self.disks[device] = section if(parent is None): self.device_node = device radio = gtk.RadioButton(None) radio.connect("clicked", self.select_disk_cb, device) radio.set_label(section) self.wTree.get_widget("vb...
sections = line.split(":") for section in sections: section = section.strip() if("/dev/" in section): device = section.split(" ")[0].replace(" ","") self.disks[device] = section if(parent is None): self.device_node = device radio = gtk.RadioButton(None) radio.connect("clicked", self.select_disk_cb, device) radio.set_la...
def build_disks(self): import subprocess self.disks = {} inxi = subprocess.Popen("inxi -c0 -D", shell=True, stdout=subprocess.PIPE) parent = None for line in inxi.stdout: line = line.rstrip("\r\n") if(line.startswith("Disks:")): line = line.replace("Disks:", "") device = None section = line.split(":")[2].strip(" ") if(...
our_total = 9
our_total = 10
def install(self): ''' Install this baby to disk ''' # mount the media location. print " --> Installation started" try: if(not os.path.exists("/target")): os.mkdir("/target") if(not os.path.exists("/source")): os.mkdir("/source") # find the squashfs.. root = self.media root_type = self.media_type if(not os.path.exists(...
self.device_node = device
def build_disks(self): gtk.gdk.threads_enter() import subprocess self.disks = {} inxi = subprocess.Popen("inxi -c0 -D", shell=True, stdout=subprocess.PIPE) parent = None for line in inxi.stdout: line = line.rstrip("\r\n") if(line.startswith("Disks:")): line = line.replace("Disks:", "") device = None sections = line.spl...
radio.connect("clicked", self.select_disk_cb, device) radio.set_label(description) self.wTree.get_widget("vbox_disks").pack_start(radio, expand=False, fill=False)
def build_disks(self): gtk.gdk.threads_enter() import subprocess self.disks = {} inxi = subprocess.Popen("inxi -c0 -D", shell=True, stdout=subprocess.PIPE) parent = None for line in inxi.stdout: line = line.rstrip("\r\n") if(line.startswith("Disks:")): line = line.replace("Disks:", "") device = None sections = line.spl...
radio = gtk.RadioButton(parent) radio.connect("clicked", self.select_disk_cb, device) radio.set_label(description) self.wTree.get_widget("vbox_disks").pack_start(radio, expand=False, fill=False)
radio = gtk.RadioButton(parent) radio.connect("clicked", self.select_disk_cb, device) radio.set_label(description) self.wTree.get_widget("vbox_disks").pack_start(radio, expand=False, fill=False) grub_model.append([device])
def build_disks(self): gtk.gdk.threads_enter() import subprocess self.disks = {} inxi = subprocess.Popen("inxi -c0 -D", shell=True, stdout=subprocess.PIPE) parent = None for line in inxi.stdout: line = line.rstrip("\r\n") if(line.startswith("Disks:")): line = line.replace("Disks:", "") device = None sections = line.spl...
grub_model = gtk.ListStore(str)
def build_partitions(self): gtk.gdk.threads_enter() self.window.set_sensitive(False) # "busy" cursor. cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) self.window.window.set_cursor(cursor) from progress import ProgressDialog dialog = ProgressDialog() dialog.show(title=_("Installer"), label=_("Scanning disk %s for partitions") % ...
path = self.device_node grub_model.append([path])
path = self.device_node
def build_partitions(self): gtk.gdk.threads_enter() self.window.set_sensitive(False) # "busy" cursor. cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) self.window.window.set_cursor(cursor) from progress import ProgressDialog dialog = ProgressDialog() dialog.show(title=_("Installer"), label=_("Scanning disk %s for partitions") % ...
self.wTree.get_widget("treeview_disks").set_model(model) self.wTree.get_widget("combobox_grub").set_model(grub_model) self.wTree.get_widget("combobox_grub").set_active(0)
self.wTree.get_widget("treeview_disks").set_model(model)
def build_partitions(self): gtk.gdk.threads_enter() self.window.set_sensitive(False) # "busy" cursor. cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) self.window.window.set_cursor(cursor) from progress import ProgressDialog dialog = ProgressDialog() dialog.show(title=_("Installer"), label=_("Scanning disk %s for partitions") % ...
cr.set_source_rgba(0, 0, 0, 0) cr.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) cr.clip()
def do_expose_event(self, event):
top = model.append(None) model.set(top, 0, "Filesystem operations")
def show_overview(self): ''' build the summary page ''' model = gtk.TreeStore(str) top = model.append(None) model.set(top, 0, "Filesystem operations") top = model.append(None) model.set(top, 0, _("Localization")) iter = model.append(top) model.set(iter, 0, "Language: <b>%s</b>" % self.locale) iter = model.append(top) ...
model.set(iter, 0, "Language: <b>%s</b>" % self.locale)
model.set(iter, 0, _("Language: ") + "<b>%s</b>" % self.locale)
def show_overview(self): ''' build the summary page ''' model = gtk.TreeStore(str) top = model.append(None) model.set(top, 0, "Filesystem operations") top = model.append(None) model.set(top, 0, _("Localization")) iter = model.append(top) model.set(iter, 0, "Language: <b>%s</b>" % self.locale) iter = model.append(top) ...