Michael Felt wrote: > First, a simple one: > > sysconfig.is_python_build() > > Return True if the current Python installation was built from source. > >>>> sysconfig.is_python_build() > False > > Now, not earth shattering, but I did build this from source - so can > someone help me with understanding why Python says no?
Looking into the source of a self-compilee Python version: $ python3.6 Python 3.6.0a0 (default:c092148a1b55+, Mar 1 2016, 15:26:05) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sysconfig, inspect >>> print(inspect.getsource(sysconfig.is_python_build)) def is_python_build(check_home=False): if check_home and _sys_home: return _is_python_source_dir(_sys_home) return _is_python_source_dir(_PROJECT_BASE) >>> print(inspect.getsource(sysconfig._is_python_source_dir)) def _is_python_source_dir(d): for fn in ("Setup.dist", "Setup.local"): if os.path.isfile(os.path.join(d, "Modules", fn)): return True return False >>> sysconfig._PROJECT_BASE '/usr/local/bin' So this effectively looks for the file /usr/local/bin/Modules/Setup.dist or /usr/local/bin/Modules/Setup.local which of course fails. You have to invoke the interpreter in the directory where it was built: $ /wherever/you/unpacked/and/compiled/python Python 3.6.0a0 (default:c092148a1b55+, Mar 1 2016, 15:26:05) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sysconfig >>> sysconfig.is_python_build() True > And a last question (more about the configure phase I expect) > > ...() returns, among other things: > > 'LIBRARY_OBJS': '\\', > 'MODULE_OBJS': '\\', > 'PARSER_HEADERS': '\\', > 'PGENSRCS': '\\ \\', > 'PYTHON_OBJS': '\\', > 'QUICKTESTOPTS': '-l -x test_subprocess test_io test_lib2to3 \\', > > 'SHLIB_EXT': '".so"', > > Why are any of these using '\\' for anything on 'posix'? Is that data actually used anywhere? I suspect this is a parsing mishap and these are actually line continuation indicators. In the Makefile I find (e. g.) PYTHON_OBJS= \ Python/_warnings.o \ Python/Python-ast.o \ Python/asdl.o \ [snip] -- https://mail.python.org/mailman/listinfo/python-list