Skip to content

Commit

Permalink
Revert "Disallow repeat calls to .initialize in one place."
Browse files Browse the repository at this point in the history
This reverts commit 3e4c7a7.
  • Loading branch information
jaraco committed Aug 10, 2022
1 parent b65aa40 commit ba9a3ea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def __init__(self, verbose=0, dry_run=0, force=0):
super().__init__(verbose, dry_run, force)
# target platform (.plat_name is consistent with 'bdist')
self.plat_name = None
self.initialized = False

@classmethod
def _configure(cls, vc_env):
Expand All @@ -236,9 +237,8 @@ def _parse_path(val):
return [dir.rstrip(os.sep) for dir in val.split(os.pathsep) if dir]

def initialize(self, plat_name=None):
def _repeat_call_error(plat_name=None):
raise AssertionError("repeat initialize not allowed")
self.initialize = _repeat_call_error
# multi-init means we would need to check platform same each time...
assert not self.initialized, "don't init multiple times"
if plat_name is None:
plat_name = get_platform()
# sanity check for platforms to prevent obscure errors later.
Expand Down Expand Up @@ -314,6 +314,8 @@ def _repeat_call_error(plat_name=None):
(CCompiler.SHARED_LIBRARY, True): self.ldflags_static_debug,
}

self.initialized = True

# -- Worker methods ------------------------------------------------

def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
Expand Down

0 comments on commit ba9a3ea

Please sign in to comment.