| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,8 @@ jobs: | |||
| 8 | 8 | fail-fast: false | |
| 9 | 9 | matrix: | |
| 10 | 10 | os: [macos-latest, ubuntu-latest, windows-latest] | |
| 11 | + python: [3.6, 3.9] | ||
| 12 | + | ||
| 11 | 13 | runs-on: ${{ matrix.os }} | |
| 12 | 14 | steps: | |
| 13 | 15 | - name: Clone gyp-next | |
@@ -24,7 +26,7 @@ jobs: | |||
| 24 | 26 | node-version: 14.x | |
| 25 | 27 | - uses: actions/setup-python@v2 | |
| 26 | 28 | with: | |
| 27 | - python-version: 3.9 | ||
| 29 | + python-version: ${{ matrix.python }} | ||
| 28 | 30 | - name: Install dependencies | |
| 29 | 31 | run: | | |
| 30 | 32 | cd node-gyp | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,21 @@ | |||
| 1 | 1 | # Changelog | |
| 2 | 2 | ||
| 3 | + ### [0.9.5](https://www.github.com/nodejs/gyp-next/compare/v0.9.4...v0.9.5) (2021-08-18) | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + ### Bug Fixes | ||
| 7 | + | ||
| 8 | + * add python 3.6 to node-gyp integration test ([3462d4c](https://www.github.com/nodejs/gyp-next/commit/3462d4ce3c31cce747513dc7ca9760c81d57c60e)) | ||
| 9 | + * revert for windows compatibility ([d078e7d](https://www.github.com/nodejs/gyp-next/commit/d078e7d7ae080ddae243188f6415f940376a7368)) | ||
| 10 | + * support msvs_quote_cmd in ninja generator ([#117](https://www.github.com/nodejs/gyp-next/issues/117)) ([46486ac](https://www.github.com/nodejs/gyp-next/commit/46486ac6e9329529d51061e006a5b39631e46729)) | ||
| 11 | + | ||
| 12 | + ### [0.9.4](https://www.github.com/nodejs/gyp-next/compare/v0.9.3...v0.9.4) (2021-08-09) | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + ### Bug Fixes | ||
| 16 | + | ||
| 17 | + * .S is an extension for asm file on Windows ([#115](https://www.github.com/nodejs/gyp-next/issues/115)) ([d2fad44](https://www.github.com/nodejs/gyp-next/commit/d2fad44ef3a79ca8900f1307060153ded57053fc)) | ||
| 18 | + | ||
| 3 | 19 | ### [0.9.3](https://www.github.com/nodejs/gyp-next/compare/v0.9.2...v0.9.3) (2021-07-07) | |
| 4 | 20 | ||
| 5 | 21 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -123,10 +123,7 @@ def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, | |||
| 123 | 123 | ||
| 124 | 124 | default_encoding = locale.getdefaultlocale()[1] | |
| 125 | 125 | if default_encoding and default_encoding.upper() != encoding.upper(): | |
| 126 | - if win32 and sys.version_info < (3, 7): | ||
| 127 | - xml_string = xml_string.decode("cp1251").encode(encoding) | ||
| 128 | - else: | ||
| 129 | - xml_string = xml_string.encode(encoding) | ||
| 126 | + xml_string = xml_string.encode(encoding) | ||
| 130 | 127 | ||
| 131 | 128 | # Get the old content | |
| 132 | 129 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -654,18 +654,18 @@ def WriteActions( | |||
| 654 | 654 | description = self.GenerateDescription( | |
| 655 | 655 | "ACTION", action.get("message", None), name | |
| 656 | 656 | ) | |
| 657 | - is_cygwin = ( | ||
| 658 | - self.msvs_settings.IsRuleRunUnderCygwin(action) | ||
| 657 | + win_shell_flags = ( | ||
| 658 | + self.msvs_settings.GetRuleShellFlags(action) | ||
| 659 | 659 | if self.flavor == "win" | |
| 660 | - else False | ||
| 660 | + else None | ||
| 661 | 661 | ) | |
| 662 | 662 | args = action["action"] | |
| 663 | 663 | depfile = action.get("depfile", None) | |
| 664 | 664 | if depfile: | |
| 665 | 665 | depfile = self.ExpandSpecial(depfile, self.base_to_build) | |
| 666 | 666 | pool = "console" if int(action.get("ninja_use_console", 0)) else None | |
| 667 | 667 | rule_name, _ = self.WriteNewNinjaRule( | |
| 668 | - name, args, description, is_cygwin, env, pool, depfile=depfile | ||
| 668 | + name, args, description, win_shell_flags, env, pool, depfile=depfile | ||
| 669 | 669 | ) | |
| 670 | 670 | ||
| 671 | 671 | inputs = [self.GypPathToNinja(i, env) for i in action["inputs"]] | |
@@ -707,14 +707,14 @@ def WriteRules( | |||
| 707 | 707 | rule.get("message", None), | |
| 708 | 708 | ("%s " + generator_default_variables["RULE_INPUT_PATH"]) % name, | |
| 709 | 709 | ) | |
| 710 | - is_cygwin = ( | ||
| 711 | - self.msvs_settings.IsRuleRunUnderCygwin(rule) | ||
| 710 | + win_shell_flags = ( | ||
| 711 | + self.msvs_settings.GetRuleShellFlags(rule) | ||
| 712 | 712 | if self.flavor == "win" | |
| 713 | - else False | ||
| 713 | + else None | ||
| 714 | 714 | ) | |
| 715 | 715 | pool = "console" if int(rule.get("ninja_use_console", 0)) else None | |
| 716 | 716 | rule_name, args = self.WriteNewNinjaRule( | |
| 717 | - name, args, description, is_cygwin, env, pool | ||
| 717 | + name, args, description, win_shell_flags, env, pool | ||
| 718 | 718 | ) | |
| 719 | 719 | ||
| 720 | 720 | # TODO: if the command references the outputs directly, we should | |
@@ -733,7 +733,7 @@ def WriteRules( | |||
| 733 | 733 | ||
| 734 | 734 | def cygwin_munge(path): | |
| 735 | 735 | # pylint: disable=cell-var-from-loop | |
| 736 | - if is_cygwin: | ||
| 736 | + if win_shell_flags and win_shell_flags.cygwin: | ||
| 737 | 737 | return path.replace("\\", "/") | |
| 738 | 738 | return path | |
| 739 | 739 | ||
@@ -1221,7 +1221,7 @@ def WriteSourcesForArch( | |||
| 1221 | 1221 | command = "cc_s" | |
| 1222 | 1222 | elif ( | |
| 1223 | 1223 | self.flavor == "win" | |
| 1224 | - and ext == "asm" | ||
| 1224 | + and ext in ("asm", "S") | ||
| 1225 | 1225 | and not self.msvs_settings.HasExplicitAsmRules(spec) | |
| 1226 | 1226 | ): | |
| 1227 | 1227 | command = "asm" | |
@@ -1899,7 +1899,7 @@ def WriteVariableList(self, ninja_file, var, values): | |||
| 1899 | 1899 | ninja_file.variable(var, " ".join(values)) | |
| 1900 | 1900 | ||
| 1901 | 1901 | def WriteNewNinjaRule( | |
| 1902 | - self, name, args, description, is_cygwin, env, pool, depfile=None | ||
| 1902 | + self, name, args, description, win_shell_flags, env, pool, depfile=None | ||
| 1903 | 1903 | ): | |
| 1904 | 1904 | """Write out a new ninja "rule" statement for a given command. | |
| 1905 | 1905 | ||
@@ -1946,13 +1946,14 @@ def WriteNewNinjaRule( | |||
| 1946 | 1946 | if self.flavor == "win": | |
| 1947 | 1947 | rspfile = rule_name + ".$unique_name.rsp" | |
| 1948 | 1948 | # The cygwin case handles this inside the bash sub-shell. | |
| 1949 | - run_in = "" if is_cygwin else " " + self.build_to_base | ||
| 1950 | - if is_cygwin: | ||
| 1949 | + run_in = "" if win_shell_flags.cygwin else " " + self.build_to_base | ||
| 1950 | + if win_shell_flags.cygwin: | ||
| 1951 | 1951 | rspfile_content = self.msvs_settings.BuildCygwinBashCommandLine( | |
| 1952 | 1952 | args, self.build_to_base | |
| 1953 | 1953 | ) | |
| 1954 | 1954 | else: | |
| 1955 | - rspfile_content = gyp.msvs_emulation.EncodeRspFileList(args) | ||
| 1955 | + rspfile_content = gyp.msvs_emulation.EncodeRspFileList( | ||
| 1956 | + args, win_shell_flags.quote) | ||
| 1956 | 1957 | command = ( | |
| 1957 | 1958 | "%s gyp-win-tool action-wrapper $arch " % sys.executable | |
| 1958 | 1959 | + rspfile | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,7 @@ | |||
| 7 | 7 | build systems, primarily ninja. | |
| 8 | 8 | """ | |
| 9 | 9 | ||
| 10 | + import collections | ||
| 10 | 11 | import os | |
| 11 | 12 | import re | |
| 12 | 13 | import subprocess | |
@@ -19,7 +20,7 @@ | |||
| 19 | 20 | windows_quoter_regex = re.compile(r'(\\*)"') | |
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | - def QuoteForRspFile(arg): | ||
| 23 | + def QuoteForRspFile(arg, quote_cmd=True): | ||
| 23 | 24 | """Quote a command line argument so that it appears as one argument when | |
| 24 | 25 | processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for | |
| 25 | 26 | Windows programs).""" | |
@@ -36,7 +37,8 @@ def QuoteForRspFile(arg): | |||
| 36 | 37 | # For a literal quote, CommandLineToArgvW requires 2n+1 backslashes | |
| 37 | 38 | # preceding it, and results in n backslashes + the quote. So we substitute | |
| 38 | 39 | # in 2* what we match, +1 more, plus the quote. | |
| 39 | - arg = windows_quoter_regex.sub(lambda mo: 2 * mo.group(1) + '\\"', arg) | ||
| 40 | + if quote_cmd: | ||
| 41 | + arg = windows_quoter_regex.sub(lambda mo: 2 * mo.group(1) + '\\"', arg) | ||
| 40 | 42 | ||
| 41 | 43 | # %'s also need to be doubled otherwise they're interpreted as batch | |
| 42 | 44 | # positional arguments. Also make sure to escape the % so that they're | |
@@ -48,12 +50,17 @@ def QuoteForRspFile(arg): | |||
| 48 | 50 | # These commands are used in rsp files, so no escaping for the shell (via ^) | |
| 49 | 51 | # is necessary. | |
| 50 | 52 | ||
| 51 | - # Finally, wrap the whole thing in quotes so that the above quote rule | ||
| 52 | - # applies and whitespace isn't a word break. | ||
| 53 | - return '"' + arg + '"' | ||
| 53 | + # As a workaround for programs that don't use CommandLineToArgvW, gyp | ||
| 54 | + # supports msvs_quote_cmd=0, which simply disables all quoting. | ||
| 55 | + if quote_cmd: | ||
| 56 | + # Finally, wrap the whole thing in quotes so that the above quote rule | ||
| 57 | + # applies and whitespace isn't a word break. | ||
| 58 | + return f'"{arg}"' | ||
| 54 | 59 | ||
| 60 | + return arg | ||
| 55 | 61 | ||
| 56 | - def EncodeRspFileList(args): | ||
| 62 | + | ||
| 63 | + def EncodeRspFileList(args, quote_cmd): | ||
| 57 | 64 | """Process a list of arguments using QuoteCmdExeArgument.""" | |
| 58 | 65 | # Note that the first argument is assumed to be the command. Don't add | |
| 59 | 66 | # quotes around it because then built-ins like 'echo', etc. won't work. | |
@@ -67,7 +74,8 @@ def EncodeRspFileList(args): | |||
| 67 | 74 | program = call + " " + os.path.normpath(program) | |
| 68 | 75 | else: | |
| 69 | 76 | program = os.path.normpath(args[0]) | |
| 70 | - return program + " " + " ".join(QuoteForRspFile(arg) for arg in args[1:]) | ||
| 77 | + return (program + " " + | ||
| 78 | + " ".join(QuoteForRspFile(arg, quote_cmd) for arg in args[1:])) | ||
| 71 | 79 | ||
| 72 | 80 | ||
| 73 | 81 | def _GenericRetrieve(root, default, path): | |
@@ -933,13 +941,22 @@ def BuildCygwinBashCommandLine(self, args, path_to_base): | |||
| 933 | 941 | ) | |
| 934 | 942 | return cmd | |
| 935 | 943 | ||
| 936 | - def IsRuleRunUnderCygwin(self, rule): | ||
| 937 | - """Determine if an action should be run under cygwin. If the variable is | ||
| 938 | - unset, or set to 1 we use cygwin.""" | ||
| 939 | - return ( | ||
| 940 | - int(rule.get("msvs_cygwin_shell", self.spec.get("msvs_cygwin_shell", 1))) | ||
| 941 | - != 0 | ||
| 942 | - ) | ||
| 944 | + RuleShellFlags = collections.namedtuple("RuleShellFlags", ["cygwin", "quote"]) | ||
| 945 | + | ||
| 946 | + def GetRuleShellFlags(self, rule): | ||
| 947 | + """Return RuleShellFlags about how the given rule should be run. This | ||
| 948 | + includes whether it should run under cygwin (msvs_cygwin_shell), and | ||
| 949 | + whether the commands should be quoted (msvs_quote_cmd).""" | ||
| 950 | + # If the variable is unset, or set to 1 we use cygwin | ||
| 951 | + cygwin = int(rule.get("msvs_cygwin_shell", | ||
| 952 | + self.spec.get("msvs_cygwin_shell", 1))) != 0 | ||
| 953 | + # Default to quoting. There's only a few special instances where the | ||
| 954 | + # target command uses non-standard command line parsing and handle quotes | ||
| 955 | + # and quote escaping differently. | ||
| 956 | + quote_cmd = int(rule.get("msvs_quote_cmd", 1)) | ||
| 957 | + assert quote_cmd != 0 or cygwin != 1, \ | ||
| 958 | + "msvs_quote_cmd=0 only applicable for msvs_cygwin_shell=0" | ||
| 959 | + return MsvsSettings.RuleShellFlags(cygwin, quote_cmd) | ||
| 943 | 960 | ||
| 944 | 961 | def _HasExplicitRuleForExtension(self, spec, extension): | |
| 945 | 962 | """Determine if there's an explicit rule for a particular extension.""" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | setup( | |
| 17 | 17 | name="gyp-next", | |
| 18 | - version="0.9.3", | ||
| 18 | + version="0.9.5", | ||
| 19 | 19 | description="A fork of the GYP build system for use in the Node.js projects", | |
| 20 | 20 | long_description=long_description, | |
| 21 | 21 | long_description_content_type="text/markdown", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments