summaryrefslogblamecommitdiff
path: root/user/node/v8-python3.patch
blob: 64151be4f435767ada4537de26ccc02b240ba64f (plain) (tree)







































































































































































                                                                                           
--- node-v10.15.3/deps/v8/tools/node/fetch_deps.py.old	2019-03-05 15:16:31.000000000 +0000
+++ node-v10.15.3/deps/v8/tools/node/fetch_deps.py	2019-04-02 01:01:00.421250178 +0000
@@ -9,6 +9,9 @@
 Usage: fetch_deps.py <v8-path>
 """
 
+# for py2/py3 compatibility
+from __future__ import print_function
+
 import os
 import subprocess
 import sys
@@ -51,9 +55,9 @@
   expected_git_dir = os.path.join(v8_path, ".git")
   actual_git_dir = git("rev-parse --absolute-git-dir")
   if expected_git_dir == actual_git_dir:
-    print "V8 is tracked stand-alone by git."
+    print("V8 is tracked stand-alone by git.")
     return False
-  print "Initializing temporary git repository in v8."
+  print("Initializing temporary git repository in v8.")
   git("init")
   git("config user.name \"Ada Lovelace\"")
   git("config user.email ada@lovela.ce")
@@ -70,7 +74,7 @@
 
   temporary_git = EnsureGit(v8_path)
   try:
-    print "Fetching dependencies."
+    print("Fetching dependencies.")
     env = os.environ.copy()
     # gclient needs to have depot_tools in the PATH.
     env["PATH"] = depot_tools + os.pathsep + env["PATH"]
--- node-v10.15.3/deps/v8/tools/node/node_common.py.old	2019-03-05 15:16:31.000000000 +0000
+++ node-v10.15.3/deps/v8/tools/node/node_common.py	2019-04-02 01:00:45.522875398 +0000
@@ -3,11 +3,15 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+# for py2/py3 compatibility
+from __future__ import print_function
+
 import os
 import pipes
 import shutil
 import stat
 import subprocess
+import sys
 
 DEPOT_TOOLS_URL = \
   "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
@@ -22,23 +26,27 @@
     except:
       pass
     if fetch_if_not_exist:
-      print "Checking out depot_tools."
+      print("Checking out depot_tools.")
       # shell=True needed on Windows to resolve git.bat.
       subprocess.check_call("git clone {} {}".format(
           pipes.quote(DEPOT_TOOLS_URL),
           pipes.quote(depot_tools)), shell=True)
+      # Using check_output to hide warning messages.
+      subprocess.check_output(
+          [sys.executable, gclient_path, "metrics", "--opt-out"],
+          cwd=depot_tools)
       return depot_tools
     return None
   depot_tools = _Get(v8_path)
   assert depot_tools is not None
-  print "Using depot tools in %s" % depot_tools
+  print("Using depot tools in %s" % depot_tools)
   return depot_tools
 
 def UninitGit(v8_path):
-  print "Uninitializing temporary git repository"
+  print("Uninitializing temporary git repository")
   target = os.path.join(v8_path, ".git")
   if os.path.isdir(target):
-    print ">> Cleaning up %s" % target
+    print(">> Cleaning up %s" % target)
     def OnRmError(func, path, exec_info):
       # This might happen on Windows
       os.chmod(path, stat.S_IWRITE)
--- node-v10.15.3/deps/v8/tools/node/update_node.py.old	2019-03-05 15:16:31.000000000 +0000
+++ node-v10.15.3/deps/v8/tools/node/update_node.py	2019-04-02 01:00:27.184875836 +0000
@@ -23,6 +23,9 @@
   --with-patch  Also include currently staged files in the V8 checkout.
 """
 
+# for py2/py3 compatibility
+from __future__ import print_function
+
 import argparse
 import os
 import shutil
@@ -61,9 +64,9 @@
 # Node.js owns deps/v8/gypfiles in their downstream repository.
 FILES_TO_KEEP = [ "gypfiles" ]
 
 def RunGclient(path):
   assert os.path.isdir(path)
-  print ">> Running gclient sync"
+  print(">> Running gclient sync")
   subprocess.check_call(["gclient", "sync", "--nohooks"], cwd=path)
 
 def CommitPatch(options):
@@ -74,7 +77,7 @@
   the fake git clone fetch it into node.js. We can leave the commit, as
   bot_update will ensure a clean state on each run.
   """
-  print ">> Committing patch"
+  print(">> Committing patch")
   subprocess.check_call(
       ["git", "-c", "user.name=fake", "-c", "user.email=fake@chromium.org",
        "commit", "--allow-empty", "-m", "placeholder-commit"],
@@ -84,8 +87,8 @@
 def UpdateTarget(repository, options, files_to_keep):
   source = os.path.join(options.v8_path, *repository)
   target = os.path.join(options.node_path, TARGET_SUBDIR, *repository)
-  print ">> Updating target directory %s" % target
-  print ">>     from active branch at %s" % source
+  print(">> Updating target directory %s" % target)
+  print(">>     from active branch at %s" % source)
   if not os.path.exists(target):
     os.makedirs(target)
   # Remove possible remnants of previous incomplete runs.
@@ -98,10 +101,11 @@
     git_args.append(["add"] + files_to_keep)            # add and commit
     git_args.append(["commit", "-m", "keep files"])     # files we want to keep
 
+  git_args.append(["clean", "-fxd"])                    # nuke everything else
   git_args.append(["remote", "add", "source", source])  # point to source repo
   git_args.append(["fetch", "source", "HEAD"])          # sync to current branch
   git_args.append(["checkout", "-f", "FETCH_HEAD"])     # switch to that branch
-  git_args.append(["clean", "-fd"])                     # delete removed files
+  git_args.append(["clean", "-fxd"])                    # delete removed files
 
   if files_to_keep:
     git_args.append(["cherry-pick", "master"])    # restore kept files
@@ -117,17 +120,17 @@
 def UpdateGitIgnore(options):
   file_name = os.path.join(options.node_path, TARGET_SUBDIR, ".gitignore")
   assert os.path.isfile(file_name)
-  print ">> Updating .gitignore with lines"
+  print(">> Updating .gitignore with lines")
   with open(file_name) as gitignore:
     content = gitignore.readlines()
   content = [x.strip() for x in content]
   for x in DELETE_FROM_GITIGNORE:
     if x in content:
-      print "- %s" % x
+      print("- %s" % x)
       content.remove(x)
   for x in ADD_TO_GITIGNORE:
     if x not in content:
-      print "+ %s" % x
+      print("+ %s" % x)
       content.append(x)
   content.sort(key=lambda x: x[1:] if x.startswith("!") else x)
   with open(file_name, "w") as gitignore:
@@ -135,7 +138,7 @@
       gitignore.write("%s\n" % x)
 
 def CreateCommit(options):
-  print ">> Creating commit."
+  print(">> Creating commit.")
   # Find git hash from source.
   githash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"],
                                     cwd=options.v8_path).strip()