diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2014-02-17 17:47:44 -0500 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2014-02-17 17:47:44 -0500 |
commit | eafdec383cf6a99dc7a4c1a26107db306a133f08 (patch) | |
tree | e9ceb56122b9114f0ccf92f3fe19bfca3372fe7a /unrpyc | |
parent | 91922ff576405c2890c41dcd76c3c165e7a8151d (diff) | |
download | html5ks-eafdec383cf6a99dc7a4c1a26107db306a133f08.tar.xz html5ks-eafdec383cf6a99dc7a4c1a26107db306a133f08.zip |
clarify LICENSE, delete some unused files
Diffstat (limited to 'unrpyc')
-rw-r--r-- | unrpyc/LICENSE | 20 | ||||
-rw-r--r-- | unrpyc/decompiler.py | 20 | ||||
-rw-r--r-- | unrpyc/renpy/README | 1 | ||||
-rw-r--r-- | unrpyc/renpy/__init__.py | 7 | ||||
-rw-r--r-- | unrpyc/renpy/display/__init__.py | 8 | ||||
-rw-r--r-- | unrpyc/renpy/log.py | 152 | ||||
-rw-r--r-- | unrpyc/unrpyc.py | 62 |
7 files changed, 8 insertions, 262 deletions
diff --git a/unrpyc/LICENSE b/unrpyc/LICENSE deleted file mode 100644 index 0279e04..0000000 --- a/unrpyc/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The renpy directory is also distributed under the MIT license located at -renpy/LICENSE.txt. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/unrpyc/decompiler.py b/unrpyc/decompiler.py index ab91732..de80147 100644 --- a/unrpyc/decompiler.py +++ b/unrpyc/decompiler.py @@ -1,23 +1,3 @@ -# Copyright (c) 2012 Yuri K. Schlesner -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - import ast as python_ast import renpy.ast as ast import renpy.atl as atl diff --git a/unrpyc/renpy/README b/unrpyc/renpy/README deleted file mode 100644 index 0e04cdc..0000000 --- a/unrpyc/renpy/README +++ /dev/null @@ -1 +0,0 @@ -This is Ren'Py 6.15.4 with significant deletions (to minimize size). diff --git a/unrpyc/renpy/__init__.py b/unrpyc/renpy/__init__.py index 443cb49..f2bd463 100644 --- a/unrpyc/renpy/__init__.py +++ b/unrpyc/renpy/__init__.py @@ -90,15 +90,9 @@ def import_cython(): def import_all(): - import renpy.log #@UnresolvedImport import renpy.display #@UnresolvedImport - # Should probably be early, as we will add it as a base to serialized things. - import renpy.object #@UnresolvedImport - - import renpy.game #@UnresolvedImport - # Adds in the Ren'Py loader. import renpy.loader #@UnresolvedImport @@ -237,7 +231,6 @@ def reload_all(): renpy.display.im.cache.quit() blacklist = [ "renpy", - "renpy.log", "renpy.bootstrap", "renpy.display", "renpy.display.pgrender", diff --git a/unrpyc/renpy/display/__init__.py b/unrpyc/renpy/display/__init__.py index 055dad6..3420500 100644 --- a/unrpyc/renpy/display/__init__.py +++ b/unrpyc/renpy/display/__init__.py @@ -19,8 +19,6 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import renpy.log - # The draw object through which all drawing is routed. This object # contains all of the distinction between the software and GL # renderers. @@ -31,9 +29,3 @@ interface = None # Should we disable imagedissolve-type transitions? less_imagedissolve = False - -# Logs we use. -log = renpy.log.open("log", developer=False, append=False) -ic_log = renpy.log.open("image_cache", developer=True, append=False) -to_log = renpy.log.open("text_overflow", developer=True, append=True) - diff --git a/unrpyc/renpy/log.py b/unrpyc/renpy/log.py deleted file mode 100644 index 37fec9a..0000000 --- a/unrpyc/renpy/log.py +++ /dev/null @@ -1,152 +0,0 @@ -# Copyright 2004-2013 Tom Rothamel <pytom@bishoujo.us> -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation files -# (the "Software"), to deal in the Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, sublicense, and/or sell copies of the Software, -# and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# This module handles the logging of messages to a file. - -import os.path -import codecs -import traceback -import platform -import time -import tempfile - -import renpy - -# The file events are logged to. -log_file = None - -class LogFile(object): - """ - This manages one of our logfiles. - """ - - def __init__(self, name, append=False, developer=False): - """ - `name` - The name of the logfile, without the .txt extension. - `append` - If true, we will append to the logfile. If false, we will truncate - it to an empty file the first time we write to it. - `developer` - If true, nothing happens if config.developer is not set to True. - """ - - self.name = name - self.append = append - self.developer = developer - self.file = None - - # File-like attributes. - self.softspace = 0 - self.newlines = None - - # Should we emulate file's write method? We do so if this is True. - self.raw_write = False - - def open(self): #@ReservedAssignment - - if self.file: - return True - - if self.developer and not renpy.config.developer: - return False - - if not renpy.config.log_enable: - return False - - try: - base = os.environ.get("RENPY_LOG_BASE", renpy.config.basedir) - fn = os.path.join(base, self.name + ".txt") - - altfn = os.path.join(tempfile.gettempdir(), "renpy-" + self.name + ".txt") - - - if renpy.android: - print("Logging to", fn) - - if self.append: - mode = "a" - else: - mode = "w" - - try: - self.file = codecs.open(fn, mode, "utf-8") - except: - self.file = codecs.open(altfn, mode, "utf-8") - - if self.append: - self.write('') - self.write('=' * 78) - self.write('') - - self.write("%s", time.ctime()) - self.write("%s", platform.platform()) - self.write("%s", renpy.version) - self.write("%s %s", renpy.config.name, renpy.config.version) - self.write("") - - return True - - except: - return False - - def write(self, s, *args): - """ - Formats `s` with args, and writes it to the logfile. - """ - - if self.open(): - - if not self.raw_write: - s = s % args - s += "\n" - - if not isinstance(s, str): - s = s.decode("latin-1") - - s = s.replace("\n", "\r\n") - - self.file.write(s) - self.file.flush() - - def exception(self): - """ - Writes the exception to the logfile. - """ - - self.raw_write = True - traceback.print_exc(None, self) - self.raw_write = False - -# A map from the log name to a log object. -log_cache = { } - -def open(name, append=False, developer=False): #@ReservedAssignment - rv = log_cache.get(name, None) - - if rv is None: - rv = LogFile(name, append=append, developer=developer) - log_cache[name] = rv - - return rv - - - diff --git a/unrpyc/unrpyc.py b/unrpyc/unrpyc.py index 6bdde42..54ca818 100644 --- a/unrpyc/unrpyc.py +++ b/unrpyc/unrpyc.py @@ -1,25 +1,3 @@ -#!/usr/bin/env python2 - -# Copyright (c) 2012 Yuri K. Schlesner -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - import optparse import os.path import sys @@ -40,7 +18,7 @@ def import_renpy(basedir=None): sys.path.append(basedir) global renpy global decompiler - + # Needed for pickle to read the AST try: import renpy @@ -48,41 +26,17 @@ def import_renpy(basedir=None): print("\nFailed at importing renpy. Are you sure that the renpy directory can be found in sys.path or the current working directory?\n") raise # try to import as much renpy modules as possible, but some modules might not exist - # in older ren'py versions. - try: import renpy.log - except: pass - try: import renpy.display - except: pass + # in older ren'py versions. try: import renpy.object except: pass - try: + try: import renpy.game renpy.game.script = Dummy() except: pass - try: import renpy.loader - except: pass try: import renpy.ast except: pass try: import renpy.atl except: pass - try: import renpy.curry - except: pass - try: import renpy.easy - except: pass - try: import renpy.execution - except: pass - try: import renpy.loadsave - except: pass - try: import renpy.parser - except: pass - try: import renpy.python - except: pass - try: import renpy.script - except: pass - try: import renpy.statements - except: pass - try: import renpy.style - except: pass import decompiler if basedir: @@ -99,7 +53,7 @@ def decompile_rpyc(input_filename, out_filename, overwrite=False, ignore_python= path, ext = os.path.splitext(input_filename) print(("Decompiling %s to %s..." % (input_filename, out_filename))) - + if not overwrite and os.path.exists(out_filename): print("Output file already exists. Pass --clobber to overwrite.") return False # Don't stop decompiling if one file already exists @@ -118,15 +72,15 @@ if __name__ == "__main__": parser.add_option('-c', '--clobber', action='store_true', dest='clobber', default=False, help="overwrites existing output files") - - parser.add_option('-b', '--basedir', action='store', dest='basedir', - help="specify the game base directory in which the 'renpy' directory is located") + + parser.add_option('-b', '--basedir', action='store', dest='basedir', + help="specify the game base directory in which the 'renpy' directory is located") parser.add_option('-p', '--ignore-python', action='store_true', dest='ignore_python', default=False, help="ignore python blocks") options, args = parser.parse_args() - + if options.basedir: import_renpy(options.basedir) |