Skip to content

Commit

Permalink
Merge pull request #200 from pypa/bugfix/178-include-posix-prefix
Browse files Browse the repository at this point in the history
For 'get_python_inc', bypass missing config include dir
  • Loading branch information
jaraco authored Feb 6, 2023
2 parents ca3195b + 67bb76c commit fb2a173
Show file tree
Hide file tree
Showing 43 changed files with 50 additions and 75 deletions.
3 changes: 0 additions & 3 deletions distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ def compile( # noqa: C901
extra_postargs=None,
depends=None,
):

if not self.initialized:
self.initialize()
compile_info = self._setup_compile(
Expand Down Expand Up @@ -426,7 +425,6 @@ def compile( # noqa: C901
def create_static_lib(
self, objects, output_libname, output_dir=None, debug=0, target_lang=None
):

if not self.initialized:
self.initialize()
objects, output_dir = self._fix_object_args(objects, output_dir)
Expand Down Expand Up @@ -460,7 +458,6 @@ def link(
build_temp=None,
target_lang=None,
):

if not self.initialized:
self.initialize()
objects, output_dir = self._fix_object_args(objects, output_dir)
Expand Down
6 changes: 0 additions & 6 deletions distutils/bcppcompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class BCPPCompiler(CCompiler):
exe_extension = '.exe'

def __init__(self, verbose=0, dry_run=0, force=0):

super().__init__(verbose, dry_run, force)

# These executables are assumed to all be in the path.
Expand Down Expand Up @@ -98,7 +97,6 @@ def compile( # noqa: C901
extra_postargs=None,
depends=None,
):

macros, objects, extra_postargs, pp_opts, build = self._setup_compile(
output_dir, macros, include_dirs, sources, depends, extra_postargs
)
Expand Down Expand Up @@ -167,7 +165,6 @@ def compile( # noqa: C901
def create_static_lib(
self, objects, output_libname, output_dir=None, debug=0, target_lang=None
):

(objects, output_dir) = self._fix_object_args(objects, output_dir)
output_filename = self.library_filename(output_libname, output_dir=output_dir)

Expand Down Expand Up @@ -200,7 +197,6 @@ def link( # noqa: C901
build_temp=None,
target_lang=None,
):

# XXX this ignores 'build_temp'! should follow the lead of
# msvccompiler.py

Expand All @@ -219,7 +215,6 @@ def link( # noqa: C901
output_filename = os.path.join(output_dir, output_filename)

if self._need_link(objects, output_filename):

# Figure out linker args based on type of target.
if target_desc == CCompiler.EXECUTABLE:
startup_obj = 'c0w32'
Expand Down Expand Up @@ -380,7 +375,6 @@ def preprocess(
extra_preargs=None,
extra_postargs=None,
):

(_, macros, include_dirs) = self._fix_compile_args(None, macros, include_dirs)
pp_opts = gen_preprocess_options(macros, include_dirs)
pp_args = ['cpp32.exe'] + pp_opts
Expand Down
6 changes: 3 additions & 3 deletions distutils/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def dump_options(self, header=None, indent=""):
header = "command options for '%s':" % self.get_command_name()
self.announce(indent + header, level=logging.INFO)
indent = indent + " "
for (option, _, _) in self.user_options:
for option, _, _ in self.user_options:
option = option.translate(longopt_xlate)
if option[-1] == "=":
option = option[:-1]
Expand Down Expand Up @@ -291,7 +291,7 @@ def set_undefined_options(self, src_cmd, *option_pairs):
# Option_pairs: list of (src_option, dst_option) tuples
src_cmd_obj = self.distribution.get_command_obj(src_cmd)
src_cmd_obj.ensure_finalized()
for (src_option, dst_option) in option_pairs:
for src_option, dst_option in option_pairs:
if getattr(self, dst_option) is None:
setattr(self, dst_option, getattr(src_cmd_obj, src_option))

Expand Down Expand Up @@ -325,7 +325,7 @@ def get_sub_commands(self):
run for the current distribution. Return a list of command names.
"""
commands = []
for (cmd_name, method) in self.sub_commands:
for cmd_name, method in self.sub_commands:
if method is None or method(self):
commands.append(cmd_name)
return commands
Expand Down
1 change: 0 additions & 1 deletion distutils/command/bdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def append(self, item):


class bdist(Command):

description = "create a built (binary) distribution"

user_options = [
Expand Down
1 change: 0 additions & 1 deletion distutils/command/bdist_dumb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class bdist_dumb(Command):

description = "create a \"dumb\" built distribution"

user_options = [
Expand Down
3 changes: 1 addition & 2 deletions distutils/command/bdist_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class bdist_rpm(Command):

description = "create an RPM distribution"

user_options = [
Expand Down Expand Up @@ -554,7 +553,7 @@ def _make_spec_file(self): # noqa: C901
('postun', 'post_uninstall', None),
]

for (rpm_opt, attr, default) in script_options:
for rpm_opt, attr, default in script_options:
# Insert contents of file referred to, if no file is referred to
# use 'default' as contents of script
val = getattr(self, attr)
Expand Down
1 change: 0 additions & 1 deletion distutils/command/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def show_compilers():


class build(Command):

description = "build everything needed to install"

user_options = [
Expand Down
9 changes: 4 additions & 5 deletions distutils/command/build_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def show_compilers():


class build_clib(Command):

description = "build C/C++ libraries used by Python extensions"

user_options = [
Expand Down Expand Up @@ -103,7 +102,7 @@ def run(self):
self.compiler.set_include_dirs(self.include_dirs)
if self.define is not None:
# 'define' option is a list of (name,value) tuples
for (name, value) in self.define:
for name, value in self.define:
self.compiler.define_macro(name, value)
if self.undef is not None:
for macro in self.undef:
Expand Down Expand Up @@ -155,14 +154,14 @@ def get_library_names(self):
return None

lib_names = []
for (lib_name, build_info) in self.libraries:
for lib_name, build_info in self.libraries:
lib_names.append(lib_name)
return lib_names

def get_source_files(self):
self.check_library_list(self.libraries)
filenames = []
for (lib_name, build_info) in self.libraries:
for lib_name, build_info in self.libraries:
sources = build_info.get('sources')
if sources is None or not isinstance(sources, (list, tuple)):
raise DistutilsSetupError(
Expand All @@ -175,7 +174,7 @@ def get_source_files(self):
return filenames

def build_libraries(self, libraries):
for (lib_name, build_info) in libraries:
for lib_name, build_info in libraries:
sources = build_info.get('sources')
if sources is None or not isinstance(sources, (list, tuple)):
raise DistutilsSetupError(
Expand Down
3 changes: 1 addition & 2 deletions distutils/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def show_compilers():


class build_ext(Command):

description = "build C/C++ extensions (compile/link to build directory)"

# XXX thoughts on how to deal with complex command-line options like
Expand Down Expand Up @@ -328,7 +327,7 @@ def run(self): # noqa: C901
self.compiler.set_include_dirs(self.include_dirs)
if self.define is not None:
# 'define' option is a list of (name,value) tuples
for (name, value) in self.define:
for name, value in self.define:
self.compiler.define_macro(name, value)
if self.undef is not None:
for macro in self.undef:
Expand Down
7 changes: 3 additions & 4 deletions distutils/command/build_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class build_py(Command):

description = "\"build\" pure Python modules (copy to build directory)"

user_options = [
Expand Down Expand Up @@ -310,7 +309,7 @@ def get_module_outfile(self, build_dir, package, module):
def get_outputs(self, include_bytecode=1):
modules = self.find_all_modules()
outputs = []
for (package, module, module_file) in modules:
for package, module, module_file in modules:
package = package.split('.')
filename = self.get_module_outfile(self.build_lib, package, module)
outputs.append(filename)
Expand Down Expand Up @@ -352,7 +351,7 @@ def build_module(self, module, module_file, package):

def build_modules(self):
modules = self.find_modules()
for (package, module, module_file) in modules:
for package, module, module_file in modules:
# Now "build" the module -- ie. copy the source file to
# self.build_lib (the build directory for Python source).
# (Actually, it gets copied to the directory for this package
Expand All @@ -375,7 +374,7 @@ def build_packages(self):

# Now loop over the modules we found, "building" each one (just
# copy it to self.build_lib).
for (package_, module, module_file) in modules:
for package_, module, module_file in modules:
assert package == package_
self.build_module(module, module_file, package)

Expand Down
1 change: 0 additions & 1 deletion distutils/command/build_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class build_scripts(Command):

description = "\"build\" scripts (copy and fixup #! line)"

user_options = [
Expand Down
1 change: 0 additions & 1 deletion distutils/command/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class clean(Command):

description = "clean up temporary files from 'build' command"
user_options = [
('build-base=', 'b', "base build directory (default: 'build.build-base')"),
Expand Down
1 change: 0 additions & 1 deletion distutils/command/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class config(Command):

description = "prepare to build"

user_options = [
Expand Down
1 change: 0 additions & 1 deletion distutils/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ def _pypy_hack(name):


class install(Command):

description = "install everything from build directory"

user_options = [
Expand Down
1 change: 0 additions & 1 deletion distutils/command/install_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class install_data(Command):

description = "install data files"

user_options = [
Expand Down
1 change: 0 additions & 1 deletion distutils/command/install_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# XXX force is never used
class install_headers(Command):

description = "install C/C++ header files"

user_options = [
Expand Down
1 change: 0 additions & 1 deletion distutils/command/install_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class install_lib(Command):

description = "install all Python modules (extensions and pure Python)"

# The byte-compilation options are a tad confusing. Here are the
Expand Down
1 change: 0 additions & 1 deletion distutils/command/install_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class install_scripts(Command):

description = "install scripts (Python or otherwise)"

user_options = [
Expand Down
1 change: 0 additions & 1 deletion distutils/command/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class register(PyPIRCCommand):

description = "register the distribution with the Python package index"
user_options = PyPIRCCommand.user_options + [
('list-classifiers', None, 'list the valid Trove classifiers'),
Expand Down
1 change: 0 additions & 1 deletion distutils/command/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def show_formats():


class sdist(Command):

description = "create a source distribution (tarball, zip file, etc.)"

def checking_metadata(self):
Expand Down
1 change: 0 additions & 1 deletion distutils/command/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class upload(PyPIRCCommand):

description = "upload binary package to PyPI"

user_options = PyPIRCCommand.user_options + [
Expand Down
2 changes: 0 additions & 2 deletions distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class CygwinCCompiler(UnixCCompiler):
exe_extension = ".exe"

def __init__(self, verbose=0, dry_run=0, force=0):

super().__init__(verbose, dry_run, force)

status, details = check_config_h()
Expand Down Expand Up @@ -269,7 +268,6 @@ class Mingw32CCompiler(CygwinCCompiler):
compiler_type = 'mingw32'

def __init__(self, verbose=0, dry_run=0, force=0):

super().__init__(verbose, dry_run, force)

shared_option = "-shared"
Expand Down
Loading

0 comments on commit fb2a173

Please sign in to comment.