3030import gyp .common
3131import gyp .xcode_emulation
3232from gyp .common import GetEnvironFallback
33- from gyp .common import GypError
3433
3534import hashlib
3635
@@ -177,7 +176,7 @@ def CalculateGeneratorInputInfo(params):
177176
178177quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
179178cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
180- """
179+ """ # noqa: E501
181180
182181LINK_COMMANDS_MAC = """\
183182 quiet_cmd_alink = LIBTOOL-STATIC $@
@@ -191,7 +190,7 @@ def CalculateGeneratorInputInfo(params):
191190
192191quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
193192cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
194- """
193+ """ # noqa: E501
195194
196195LINK_COMMANDS_ANDROID = """\
197196 quiet_cmd_alink = AR($(TOOLSET)) $@
@@ -218,7 +217,7 @@ def CalculateGeneratorInputInfo(params):
218217cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
219218quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@
220219cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
221- """
220+ """ # noqa: E501
222221
223222
224223LINK_COMMANDS_AIX = """\
@@ -236,7 +235,7 @@ def CalculateGeneratorInputInfo(params):
236235
237236quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
238237cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
239- """
238+ """ # noqa: E501
240239
241240
242241LINK_COMMANDS_OS390 = """\
@@ -254,8 +253,7 @@ def CalculateGeneratorInputInfo(params):
254253
255254quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
256255cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -Wl,DLL
257-
258- """
256+ """ # noqa: E501
259257
260258
261259# Header of toplevel Makefile.
@@ -404,7 +402,7 @@ def CalculateGeneratorInputInfo(params):
404402cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp %(copy_archive_args)s "$<" "$@")
405403
406404%(link_commands)s
407- """
405+ """ # noqa: E501
408406 r"""
409407# Define an escape_quotes function to escape single quotes.
410408# This allows us to handle quotes properly as long as we always use
@@ -503,7 +501,7 @@ def CalculateGeneratorInputInfo(params):
503501.PHONY: FORCE_DO_CMD
504502FORCE_DO_CMD:
505503
506- """
504+ """ # noqa: E501
507505)
508506
509507SHARED_HEADER_MAC_COMMANDS = """
@@ -534,7 +532,7 @@ def CalculateGeneratorInputInfo(params):
534532
535533quiet_cmd_infoplist = INFOPLIST $@
536534cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
537- """
535+ """ # noqa: E501
538536
539537
540538def WriteRootHeaderSuffixRules (writer ):
@@ -672,43 +670,6 @@ def SourceifyAndQuoteSpaces(path):
672670 return QuoteSpaces (Sourceify (path ))
673671
674672
675- # TODO: Avoid code duplication with _ValidateSourcesForMSVSProject in msvs.py.
676- def _ValidateSourcesForOSX (spec , all_sources ):
677- """Makes sure if duplicate basenames are not specified in the source list.
678-
679- Arguments:
680- spec: The target dictionary containing the properties of the target.
681- """
682- if spec .get ("type" , None ) != "static_library" :
683- return
684-
685- basenames = {}
686- for source in all_sources :
687- name , ext = os .path .splitext (source )
688- is_compiled_file = ext in [".c" , ".cc" , ".cpp" , ".cxx" , ".m" , ".mm" , ".s" , ".S" ]
689- if not is_compiled_file :
690- continue
691- basename = os .path .basename (name ) # Don't include extension.
692- basenames .setdefault (basename , []).append (source )
693-
694- error = ""
695- for basename , files in basenames .items ():
696- if len (files ) > 1 :
697- error += " %s: %s\n " % (basename , " " .join (files ))
698-
699- if error :
700- print (
701- (
702- "static library %s has several files with the same basename:\n "
703- % spec ["target_name" ]
704- )
705- + error
706- + "libtool on OS X will generate"
707- + " warnings for them."
708- )
709- raise GypError ("Duplicate basenames in sources section, see list above" )
710-
711-
712673# Map from qualified target to path to output.
713674target_outputs = {}
714675# Map from qualified target to any linkable output. A subset
@@ -867,10 +828,6 @@ def Write(
867828 # Sources.
868829 all_sources = spec .get ("sources" , []) + extra_sources
869830 if all_sources :
870- if self .flavor == "mac" :
871- # libtool on OS X generates warnings for duplicate basenames in the same
872- # target.
873- _ValidateSourcesForOSX (spec , all_sources )
874831 self .WriteSources (
875832 configs ,
876833 deps ,
@@ -1342,7 +1299,10 @@ def WriteSources(
13421299 )
13431300
13441301 if self .flavor == "mac" :
1345- cflags = self .xcode_settings .GetCflags (configname , arch = config .get ('xcode_configuration_platform' ))
1302+ cflags = self .xcode_settings .GetCflags (
1303+ configname ,
1304+ arch = config .get ('xcode_configuration_platform' )
1305+ )
13461306 cflags_c = self .xcode_settings .GetCflagsC (configname )
13471307 cflags_cc = self .xcode_settings .GetCflagsCC (configname )
13481308 cflags_objc = self .xcode_settings .GetCflagsObjC (configname )
@@ -1659,8 +1619,8 @@ def WriteTarget(
16591619 ldflags = config .get ("ldflags" , [])
16601620 # Compute an rpath for this output if needed.
16611621 if any (dep .endswith (".so" ) or ".so." in dep for dep in deps ):
1662- # We want to get the literal string "$ORIGIN" into the link command,
1663- # so we need lots of escaping.
1622+ # We want to get the literal string "$ORIGIN"
1623+ # into the link command, so we need lots of escaping.
16641624 ldflags .append (r"-Wl,-rpath=\$$ORIGIN/lib.%s/" % self .toolset )
16651625 ldflags .append (
16661626 r"-Wl,-rpath-link=\$(builddir)/lib.%s/" % self .toolset
0 commit comments