Code looks good. The format of the diff/patch seems quite different and harder to decode than the usual.
Reviewed-by: Jaben Carsey <jaben.car...@intel.com> > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Daryl McDaniel > Sent: Friday, October 16, 2015 4:19 PM > To: edk2-devel@lists.01.org; Carsey, Jaben <jaben.car...@intel.com>; > Bjorge, Erik C <erik.c.bjo...@intel.com> > Subject: [edk2] [PATCH 1/1] AppPkg: Allow interactive Python on platforms > without STDERR > Importance: High > > AppPkg: Python, as distributed, sends its prompts and other interactive > output to stderr, which uses the platforms STDERR device for output. If > STDERR output is not visible, it may appear that Python has hung. Several > people have reported problems on platforms that don't enable STDERR. > These > include platforms without a Setup utility and those without Setup options > for STDERR. > > This patch adds a command-line switch, -#, to Python. If this switch is > present, stderr will be aliased to stdout. > > > > AppPkg/Applications/Python/PyMod-2.7.2/Modules/main.c: New file, > modified > version of AppPkg/Applications/Python/Python-2.7.2/Modules/main.c. Add > the > -# option which causes stderr to be aliased to stdout. Add a description of > this switch to the Help output. > > > > AppPkg/Applications/Python/PythonCore.inf: Reference main.c from > PyMod-2.7.2 instead of from Python-2.7.2 so that the modified version is > used. > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Daryl McDaniel <edk2-li...@mc2research.org> > > > > > > diff C3b Temp/PythonCore.inf-revBASE.svn001.tmp.inf > AppPkg/Applications/Python/PythonCore.inf > > *** Temp/PythonCore.inf-revBASE.svn001.tmp.inf Thu Sep 18 12:13:22 2014 > > --- AppPkg/Applications/Python/PythonCore.inf Fri Oct 16 14:15:13 2015 > > *************** > > *** 1,6 **** > > --- 1,7 ---- > > ## @file > > # PythonCore.inf > > # > > + # Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR> > > # Copyright (c) 2011-2012, Intel Corporation. All rights reserved.<BR> > > # This program and the accompanying materials > > # are licensed and made available under the terms and conditions of the > BSD License > > *************** > > *** 164,170 **** > > Python-$(PYTHON_VERSION)/Modules/_functoolsmodule.c > > Python-$(PYTHON_VERSION)/Modules/gcmodule.c > > Python-$(PYTHON_VERSION)/Modules/getbuildinfo.c > > ! Python-$(PYTHON_VERSION)/Modules/main.c > > Python-$(PYTHON_VERSION)/Modules/python.c > > > > # Optional Modules -- See Python/Efi/config.c > > --- 165,171 ---- > > Python-$(PYTHON_VERSION)/Modules/_functoolsmodule.c > > Python-$(PYTHON_VERSION)/Modules/gcmodule.c > > Python-$(PYTHON_VERSION)/Modules/getbuildinfo.c > > ! PyMod-$(PYTHON_VERSION)/Modules/main.c > > Python-$(PYTHON_VERSION)/Modules/python.c > > > > # Optional Modules -- See Python/Efi/config.c > > diff C3b a/AppPkg/Applications/Python/Python-2.7.2/Modules/main.c > b/AppPkg/Applications/Python/PyMod-2.7.2/Modules/main.c > > *** a/AppPkg/Applications/Python/Python-2.7.2/Modules/main.c Thu Oct > 15 > 13:08:22 2015 > > --- b/AppPkg/Applications/Python/PyMod-2.7.2/Modules/main.c Fri Oct 16 > 15:08:08 2015 > > *************** > > *** 1,4 **** > > ! /* Python interpreter main program */ > > > > #include "Python.h" > > #include "osdefs.h" > > --- 1,8 ---- > > ! /** @file > > ! Python interpreter main program. > > ! > > ! Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR> > > ! **/ > > > > #include "Python.h" > > #include "osdefs.h" > > *************** > > *** 40,46 **** > > static int orig_argc; > > > > /* command line options */ > > ! #define BASE_OPTS "3bBc:dEhiJm:OQ:sStuUvVW:xX?" > > > > #ifndef RISCOS > > #define PROGRAM_OPTS BASE_OPTS > > --- 44,50 ---- > > static int orig_argc; > > > > /* command line options */ > > ! #define BASE_OPTS "#3bBc:dEhiJm:OQ:sStuUvVW:xX?" > > > > #ifndef RISCOS > > #define PROGRAM_OPTS BASE_OPTS > > *************** > > *** 59,64 **** > > --- 63,69 ---- > > /* Long usage message, split into parts < 512 bytes */ > > static char *usage_1 = "\ > > Options and arguments (and corresponding environment variables):\n\ > > + -# : alias stderr to stdout for platforms without STDERR output.\n\ > > -B : don't write .py[co] files on import; also > PYTHONDONTWRITEBYTECODE=x\n\ > > -c cmd : program passed in as string (terminates option list)\n\ > > -d : debug output from parser; also PYTHONDEBUG=x\n\ > > *************** > > *** 99,105 **** > > static char *usage_5 = "\ > > PYTHONHOME : alternate <prefix> directory (or > <prefix>%c<exec_prefix>).\n\ > > The default module search path uses %s.\n\ > > ! PYTHONCASEOK : ignore case in 'import' statements (Windows).\n\ > > PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\ > > "; > > > > --- 104,110 ---- > > static char *usage_5 = "\ > > PYTHONHOME : alternate <prefix> directory (or > <prefix>%c<exec_prefix>).\n\ > > The default module search path uses %s.\n\ > > ! PYTHONCASEOK : ignore case in 'import' statements (UEFI default).\n\ > > PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\ > > "; > > > > *************** > > *** 241,246 **** > > --- 246,252 ---- > > int help = 0; > > int version = 0; > > int saw_unbuffered_flag = 0; > > + int saw_pound_flag = 0; > > PyCompilerFlags cf; > > > > cf.cf_flags = 0; > > *************** > > *** 389,394 **** > > --- 395,409 ---- > > PySys_AddWarnOption(_PyOS_optarg); > > break; > > > > + case '#': > > + if (saw_pound_flag == 0) { > > + if(freopen("stdout:", "w", stderr) == NULL) { > > + puts("ERROR: Unable to reopen stderr as an alias to > stdout!"); > > + } > > + saw_pound_flag = 0xFF; > > + } > > + break; > > + > > /* This space reserved for other options */ > > > > default: > > *************** > > *** 543,549 **** > > sts = PyRun_SimpleStringFlags(command, &cf) != 0; > > free(command); > > } else if (module) { > > ! sts = RunModule(module, 1); > > free(module); > > } > > else { > > --- 558,564 ---- > > sts = PyRun_SimpleStringFlags(command, &cf) != 0; > > free(command); > > } else if (module) { > > ! sts = (RunModule(module, 1) != 0); > > free(module); > > } > > else { > > > > -- > > > > Daryl McDaniel > > > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel