30
30
import gyp .common
31
31
import gyp .xcode_emulation
32
32
from gyp .common import GetEnvironFallback
33
- from gyp .common import GypError
34
33
35
34
import hashlib
36
35
@@ -177,7 +176,7 @@ def CalculateGeneratorInputInfo(params):
177
176
178
177
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
179
178
cmd_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
181
180
182
181
LINK_COMMANDS_MAC = """\
183
182
quiet_cmd_alink = LIBTOOL-STATIC $@
@@ -191,7 +190,7 @@ def CalculateGeneratorInputInfo(params):
191
190
192
191
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
193
192
cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
194
- """
193
+ """ # noqa: E501
195
194
196
195
LINK_COMMANDS_ANDROID = """\
197
196
quiet_cmd_alink = AR($(TOOLSET)) $@
@@ -218,7 +217,7 @@ def CalculateGeneratorInputInfo(params):
218
217
cmd_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)
219
218
quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@
220
219
cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
221
- """
220
+ """ # noqa: E501
222
221
223
222
224
223
LINK_COMMANDS_AIX = """\
@@ -236,7 +235,7 @@ def CalculateGeneratorInputInfo(params):
236
235
237
236
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
238
237
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
239
- """
238
+ """ # noqa: E501
240
239
241
240
242
241
LINK_COMMANDS_OS390 = """\
@@ -254,8 +253,7 @@ def CalculateGeneratorInputInfo(params):
254
253
255
254
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
256
255
cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -Wl,DLL
257
-
258
- """
256
+ """ # noqa: E501
259
257
260
258
261
259
# Header of toplevel Makefile.
@@ -404,7 +402,7 @@ def CalculateGeneratorInputInfo(params):
404
402
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp %(copy_archive_args)s "$<" "$@")
405
403
406
404
%(link_commands)s
407
- """
405
+ """ # noqa: E501
408
406
r"""
409
407
# Define an escape_quotes function to escape single quotes.
410
408
# This allows us to handle quotes properly as long as we always use
@@ -503,7 +501,7 @@ def CalculateGeneratorInputInfo(params):
503
501
.PHONY: FORCE_DO_CMD
504
502
FORCE_DO_CMD:
505
503
506
- """
504
+ """ # noqa: E501
507
505
)
508
506
509
507
SHARED_HEADER_MAC_COMMANDS = """
@@ -534,7 +532,7 @@ def CalculateGeneratorInputInfo(params):
534
532
535
533
quiet_cmd_infoplist = INFOPLIST $@
536
534
cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
537
- """
535
+ """ # noqa: E501
538
536
539
537
540
538
def WriteRootHeaderSuffixRules (writer ):
@@ -672,43 +670,6 @@ def SourceifyAndQuoteSpaces(path):
672
670
return QuoteSpaces (Sourceify (path ))
673
671
674
672
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
-
712
673
# Map from qualified target to path to output.
713
674
target_outputs = {}
714
675
# Map from qualified target to any linkable output. A subset
@@ -867,10 +828,6 @@ def Write(
867
828
# Sources.
868
829
all_sources = spec .get ("sources" , []) + extra_sources
869
830
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 )
874
831
self .WriteSources (
875
832
configs ,
876
833
deps ,
@@ -1342,7 +1299,10 @@ def WriteSources(
1342
1299
)
1343
1300
1344
1301
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
+ )
1346
1306
cflags_c = self .xcode_settings .GetCflagsC (configname )
1347
1307
cflags_cc = self .xcode_settings .GetCflagsCC (configname )
1348
1308
cflags_objc = self .xcode_settings .GetCflagsObjC (configname )
@@ -1659,8 +1619,8 @@ def WriteTarget(
1659
1619
ldflags = config .get ("ldflags" , [])
1660
1620
# Compute an rpath for this output if needed.
1661
1621
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.
1664
1624
ldflags .append (r"-Wl,-rpath=\$$ORIGIN/lib.%s/" % self .toolset )
1665
1625
ldflags .append (
1666
1626
r"-Wl,-rpath-link=\$(builddir)/lib.%s/" % self .toolset
0 commit comments