()
| 109 | # Main program |
| 110 | |
| 111 | def main(): |
| 112 | # overridable context |
| 113 | prefix = None # settable with -p option |
| 114 | exec_prefix = None # settable with -P option |
| 115 | extensions = [] |
| 116 | exclude = [] # settable with -x option |
| 117 | addn_link = [] # settable with -l, but only honored under Windows. |
| 118 | path = sys.path[:] |
| 119 | modargs = 0 |
| 120 | debug = 1 |
| 121 | odir = '' |
| 122 | win = sys.platform[:3] == 'win' |
| 123 | replace_paths = [] # settable with -r option |
| 124 | error_if_any_missing = 0 |
| 125 | |
| 126 | # default the exclude list for each platform |
| 127 | if win: exclude = exclude + [ |
| 128 | 'dos', 'dospath', 'mac', 'macfs', 'MACFS', 'posix', ] |
| 129 | |
| 130 | fail_import = exclude[:] |
| 131 | |
| 132 | # output files |
| 133 | frozen_c = 'frozen.c' |
| 134 | config_c = 'config.c' |
| 135 | target = 'a.out' # normally derived from script name |
| 136 | makefile = 'Makefile' |
| 137 | subsystem = 'console' |
| 138 | |
| 139 | if sys.platform == "darwin" and sysconfig.get_config_var("PYTHONFRAMEWORK"): |
| 140 | print(f"{sys.argv[0]} cannot be used with framework builds of Python", file=sys.stderr) |
| 141 | sys.exit(1) |
| 142 | |
| 143 | |
| 144 | # parse command line by first replacing any "-i" options with the |
| 145 | # file contents. |
| 146 | pos = 1 |
| 147 | while pos < len(sys.argv)-1: |
| 148 | # last option can not be "-i", so this ensures "pos+1" is in range! |
| 149 | if sys.argv[pos] == '-i': |
| 150 | try: |
| 151 | with open(sys.argv[pos+1]) as infp: |
| 152 | options = infp.read().split() |
| 153 | except IOError as why: |
| 154 | usage("File name '%s' specified with the -i option " |
| 155 | "can not be read - %s" % (sys.argv[pos+1], why) ) |
| 156 | # Replace the '-i' and the filename with the read params. |
| 157 | sys.argv[pos:pos+2] = options |
| 158 | pos = pos + len(options) - 1 # Skip the name and the included args. |
| 159 | pos = pos + 1 |
| 160 | |
| 161 | # Now parse the command line with the extras inserted. |
| 162 | try: |
| 163 | opts, args = getopt.getopt(sys.argv[1:], 'r:a:dEe:hmo:p:P:qs:wX:x:l:') |
| 164 | except getopt.error as msg: |
| 165 | usage('getopt error: ' + str(msg)) |
| 166 | |
| 167 | # process option arguments |
| 168 | for o, a in opts: |
no test coverage detected
searching dependent graphs…