????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 216.73.216.170 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/Python-3.6.3/Tools/freeze/ |
Upload File : |
# Parse Makefiles and Python Setup(.in) files. import re # Extract variable definitions from a Makefile. # Return a dictionary mapping names to values. # May raise IOError. makevardef = re.compile('^([a-zA-Z0-9_]+)[ \t]*=(.*)') def getmakevars(filename): variables = {} fp = open(filename) pendingline = "" try: while 1: line = fp.readline() if pendingline: line = pendingline + line pendingline = "" if not line: break if line.endswith('\\\n'): pendingline = line[:-2] matchobj = makevardef.match(line) if not matchobj: continue (name, value) = matchobj.group(1, 2) # Strip trailing comment i = value.find('#') if i >= 0: value = value[:i] value = value.strip() variables[name] = value finally: fp.close() return variables # Parse a Python Setup(.in) file. # Return two dictionaries, the first mapping modules to their # definitions, the second mapping variable names to their values. # May raise IOError. setupvardef = re.compile('^([a-zA-Z0-9_]+)=(.*)') def getsetupinfo(filename): modules = {} variables = {} fp = open(filename) pendingline = "" try: while 1: line = fp.readline() if pendingline: line = pendingline + line pendingline = "" if not line: break # Strip comments i = line.find('#') if i >= 0: line = line[:i] if line.endswith('\\\n'): pendingline = line[:-2] continue matchobj = setupvardef.match(line) if matchobj: (name, value) = matchobj.group(1, 2) variables[name] = value.strip() else: words = line.split() if words: modules[words[0]] = words[1:] finally: fp.close() return modules, variables # Test the above functions. def test(): import sys import os if not sys.argv[1:]: print('usage: python parsesetup.py Makefile*|Setup* ...') sys.exit(2) for arg in sys.argv[1:]: base = os.path.basename(arg) if base[:8] == 'Makefile': print('Make style parsing:', arg) v = getmakevars(arg) prdict(v) elif base[:5] == 'Setup': print('Setup style parsing:', arg) m, v = getsetupinfo(arg) prdict(m) prdict(v) else: print(arg, 'is neither a Makefile nor a Setup file') print('(name must begin with "Makefile" or "Setup")') def prdict(d): keys = sorted(d.keys()) for key in keys: value = d[key] print("%-15s" % key, str(value)) if __name__ == '__main__': test()