Permalink
Browse files

node-gyp@0.8.1

  • Loading branch information...
1 parent 6aaec11 commit 65be9b7c708499f922a65450116ad0cc76774b28 @isaacs isaacs committed Dec 13, 2012
Showing 1,038 changed files with 40,019 additions and 1,540 deletions.
@@ -36,10 +36,13 @@ You will also need to install:
* `make`
* A proper C/C++ compiler toolchain, like GCC
* On Windows:
- * [Python][windows-python] ([`v2.7.3`][windows-python-v2.7.3] recommended, `v3.x.x` is not supported)
- * Microsoft Visual C++ ([Express][msvc] version works well)
+ * [Python][windows-python] ([`v2.7.3`][windows-python-v2.7.3] recommended, `v3.x.x` is __*not*__ supported)
+ * Windows XP/Vista/7:
+ * Microsoft Visual Studio C++ 2010 ([Express][msvc2010] version works well)
* For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk]
- * If you get errors that the 64 bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1]
+ * If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1]
+ * Windows 8:
+ * Microsoft Visual Studio C++ 2012 for Windows Desktop ([Express][msvc2012] version works well)
How to Use
----------
@@ -149,6 +152,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[windows-python]: http://www.python.org/getit/windows
[windows-python-v2.7.3]: http://www.python.org/download/releases/2.7.3#download
-[msvc]: http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express
-[win7sdk]: http://www.microsoft.com/download/en/details.aspx?displayLang=en&id=8279
+[msvc2010]: http://go.microsoft.com/?linkid=9709949
+[msvc2012]: http://go.microsoft.com/?linkid=9816758
+[win7sdk]: http://www.microsoft.com/en-us/download/details.aspx?id=8279
[compiler update for the Windows SDK 7.1]: http://www.microsoft.com/en-us/download/details.aspx?id=4422
@@ -19,7 +19,7 @@
[ 'OS=="mac"', {
'libraries': [ '-undefined dynamic_lookup' ],
'xcode_settings': {
- 'DYLIB_INSTALL_NAME_BASE': '@loader_path'
+ 'DYLIB_INSTALL_NAME_BASE': '@rpath'
},
}],
[ 'OS=="win"', {
@@ -4,6 +4,7 @@
vars = {
"chrome_trunk": "http://src.chromium.org/svn/trunk",
+ "googlecode_url": "http://%s.googlecode.com/svn",
}
deps = {
@@ -18,5 +19,8 @@ deps_os = {
"third_party/python_26":
Var("chrome_trunk") + "/tools/third_party/python_26@89111",
+
+ "src/third_party/pefile":
+ (Var("googlecode_url") % "pefile") + "/trunk@63",
},
}
@@ -0,0 +1,109 @@
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Top-level presubmit script for GYP.
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details about the presubmit API built into gcl.
+"""
+
+
+PYLINT_BLACKLIST = [
+ # TODO: fix me.
+ # From SCons, not done in google style.
+ 'test/lib/TestCmd.py',
+ 'test/lib/TestCommon.py',
+ 'test/lib/TestGyp.py',
+ # Needs style fix.
+ 'pylib/gyp/generator/scons.py',
+ 'pylib/gyp/generator/xcode.py',
+]
+
+
+PYLINT_DISABLED_WARNINGS = [
+ # TODO: fix me.
+ # Many tests include modules they don't use.
+ 'W0611',
+ # Include order doesn't properly include local files?
+ 'F0401',
+ # Some use of built-in names.
+ 'W0622',
+ # Some unused variables.
+ 'W0612',
+ # Operator not preceded/followed by space.
+ 'C0323',
+ 'C0322',
+ # Unnecessary semicolon.
+ 'W0301',
+ # Unused argument.
+ 'W0613',
+ # String has no effect (docstring in wrong place).
+ 'W0105',
+ # Comma not followed by space.
+ 'C0324',
+ # Access to a protected member.
+ 'W0212',
+ # Bad indent.
+ 'W0311',
+ # Line too long.
+ 'C0301',
+ # Undefined variable.
+ 'E0602',
+ # Not exception type specified.
+ 'W0702',
+ # No member of that name.
+ 'E1101',
+ # Dangerous default {}.
+ 'W0102',
+ # Others, too many to sort.
+ 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231',
+ 'R0201', 'E0101', 'C0321',
+ # ************* Module copy
+ # W0104:427,12:_test.odict.__setitem__: Statement seems to have no effect
+ 'W0104',
+]
+
+
+def CheckChangeOnUpload(input_api, output_api):
+ report = []
+ report.extend(input_api.canned_checks.PanProjectChecks(
+ input_api, output_api))
+ return report
+
+
+def CheckChangeOnCommit(input_api, output_api):
+ report = []
+ license = (
+ r'.*? Copyright \(c\) %(year)s Google Inc\. All rights reserved\.\n'
+ r'.*? Use of this source code is governed by a BSD-style license that '
+ r'can be\n'
+ r'.*? found in the LICENSE file\.\n'
+ ) % {
+ 'year': input_api.time.strftime('%Y'),
+ }
+
+ report.extend(input_api.canned_checks.PanProjectChecks(
+ input_api, output_api, license_header=license))
+ report.extend(input_api.canned_checks.CheckTreeIsOpen(
+ input_api, output_api,
+ 'http://gyp-status.appspot.com/status',
+ 'http://gyp-status.appspot.com/current'))
+
+ import sys
+ old_sys_path = sys.path
+ try:
+ sys.path = ['pylib', 'test/lib'] + sys.path
+ report.extend(input_api.canned_checks.RunPylint(
+ input_api,
+ output_api,
+ black_list=PYLINT_BLACKLIST,
+ disabled_warnings=PYLINT_DISABLED_WARNINGS))
+ finally:
+ sys.path = old_sys_path
+ return report
+
+
+def GetPreferredTrySlaves():
+ return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac']
@@ -79,6 +79,7 @@ def GypBuild():
retcode += GypTestFormat('xcode')
retcode += GypTestFormat('make')
elif sys.platform == 'win32':
+ retcode += GypTestFormat('ninja')
retcode += GypTestFormat('msvs-2008', format='msvs', msvs_version='2008')
if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64':
retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010')
@@ -153,6 +153,8 @@ def main(argv=None):
help="chdir to the specified directory")
parser.add_option("-f", "--format", action="store", default='',
help="run tests with the specified formats")
+ parser.add_option("-G", '--gyp_option', action="append", default=[],
+ help="Add -G options to the gyp command line")
parser.add_option("-l", "--list", action="store_true",
help="list available tests and exit")
parser.add_option("-n", "--no-exec", action="store_true",
@@ -169,7 +171,9 @@ def main(argv=None):
os.chdir(opts.chdir)
if opts.path:
- os.environ['PATH'] += ':' + ':'.join(opts.path)
+ extra_path = [os.path.abspath(p) for p in opts.path]
+ extra_path = os.pathsep.join(extra_path)
+ os.environ['PATH'] += os.pathsep + extra_path
if not args:
if not opts.all:
@@ -220,8 +224,14 @@ def main(argv=None):
if not opts.quiet:
sys.stdout.write('TESTGYP_FORMAT=%s\n' % format)
+ gyp_options = []
+ for option in opts.gyp_option:
+ gyp_options += ['-G', option]
+ if gyp_options and not opts.quiet:
+ sys.stdout.write('Extra Gyp options: %s\n' % gyp_options)
+
for test in tests:
- status = cr.run([sys.executable, test],
+ status = cr.run([sys.executable, test] + gyp_options,
stdout=sys.stdout,
stderr=sys.stderr)
if status == 2:
@@ -1,10 +1,9 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""New implementation of Visual Studio project generation for SCons."""
-import common
import os
import random
@@ -60,7 +59,13 @@ def MakeGuid(name, seed='msvs_new'):
#------------------------------------------------------------------------------
-class MSVSFolder(object):
+class MSVSSolutionEntry(object):
+ def __cmp__(self, other):
+ # Sort by name then guid (so things are in order on vs2008).
+ return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))
+
+
+class MSVSFolder(MSVSSolutionEntry):
"""Folder in a Visual Studio project or solution."""
def __init__(self, path, name = None, entries = None,
@@ -86,7 +91,7 @@ def __init__(self, path, name = None, entries = None,
self.guid = guid
# Copy passed lists (or set to empty lists)
- self.entries = list(entries or [])
+ self.entries = sorted(list(entries or []))
self.items = list(items or [])
self.entry_type_guid = ENTRY_TYPE_GUIDS['folder']
@@ -101,7 +106,7 @@ def get_guid(self):
#------------------------------------------------------------------------------
-class MSVSProject(object):
+class MSVSProject(MSVSSolutionEntry):
"""Visual Studio project."""
def __init__(self, path, name = None, dependencies = None, guid = None,
@@ -139,10 +144,11 @@ def __init__(self, path, name = None, dependencies = None, guid = None,
else:
self.config_platform_overrides = {}
self.fixpath_prefix = fixpath_prefix
+ self.msbuild_toolset = None
def set_dependencies(self, dependencies):
self.dependencies = list(dependencies or [])
-
+
def get_guid(self):
if self.guid is None:
# Set GUID from path
@@ -160,6 +166,9 @@ def get_guid(self):
self.guid = MakeGuid(self.name)
return self.guid
+ def set_msbuild_toolset(self, msbuild_toolset):
+ self.msbuild_toolset = msbuild_toolset
+
#------------------------------------------------------------------------------
@@ -204,7 +213,7 @@ def __init__(self, path, version, entries=None, variants=None,
self.Write()
- def Write(self, writer=common.WriteOnDiff):
+ def Write(self, writer=gyp.common.WriteOnDiff):
"""Writes the solution file to disk.
Raises:
@@ -226,15 +235,7 @@ def Write(self, writer=common.WriteOnDiff):
if isinstance(e, MSVSFolder):
entries_to_check += e.entries
- # Sort by name then guid (so things are in order on vs2008).
- def NameThenGuid(a, b):
- if a.name < b.name: return -1
- if a.name > b.name: return 1
- if a.get_guid() < b.get_guid(): return -1
- if a.get_guid() > b.get_guid(): return 1
- return 0
-
- all_entries = sorted(all_entries, NameThenGuid)
+ all_entries = sorted(all_entries)
# Open file and print header
f = writer(self.path)
@@ -1,10 +1,10 @@
-# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio project reader/writer."""
-import common
+import gyp.common
import gyp.easy_xml as easy_xml
#------------------------------------------------------------------------------
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -15,7 +15,7 @@
"""
import sys
-
+import re
# Dictionaries of settings validators. The key is the tool name, the value is
# a dictionary mapping setting names to validation functions.
@@ -362,6 +362,24 @@ def _Translate(value, msbuild_settings):
_msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
+fix_vc_macro_slashes_regex_list = ('IntDir', 'OutDir')
+fix_vc_macro_slashes_regex = re.compile(
+ r'(\$\((?:%s)\))(?:[\\/]+)' % "|".join(fix_vc_macro_slashes_regex_list)
+)
+
+def FixVCMacroSlashes(s):
+ """Replace macros which have excessive following slashes.
+
+ These macros are known to have a built-in trailing slash. Furthermore, many
+ scripts hiccup on processing paths with extra slashes in the middle.
+
+ This list is probably not exhaustive. Add as needed.
+ """
+ if '$' in s:
+ s = fix_vc_macro_slashes_regex.sub(r'\1', s)
+ return s
+
+
def ConvertVCMacrosToMSBuild(s):
"""Convert the the MSVS macros found in the string to the MSBuild equivalent.
@@ -378,14 +396,10 @@ def ConvertVCMacrosToMSBuild(s):
'$(ParentName)': '$(ProjectFileName)',
'$(PlatformName)': '$(Platform)',
'$(SafeInputName)': '%(Filename)',
-
- '$(IntDir)\\': '$(IntDir)',
- '$(OutDir)\\': '$(OutDir)',
- '$(IntDir)/': '$(IntDir)',
- '$(OutDir)/': '$(OutDir)',
}
for old, new in replace_map.iteritems():
s = s.replace(old, new)
+ s = FixVCMacroSlashes(s)
return s
@@ -481,7 +495,7 @@ def _ValidateSettings(validators, settings, stderr):
_midl = _Tool('VCMIDLTool', 'Midl')
_rc = _Tool('VCResourceCompilerTool', 'ResourceCompile')
_lib = _Tool('VCLibrarianTool', 'Lib')
-_manifest = _Tool('VCManifestTool', 'Mt')
+_manifest = _Tool('VCManifestTool', 'Manifest')
_AddTool(_compile)
Oops, something went wrong.

0 comments on commit 65be9b7

Please sign in to comment.