Skip to content

Commit 79b1f04

Browse files
targoscodebytere
authored andcommittedFeb 27, 2020
tools: sync gyp code base with node-gyp repo
PR-URL: #30563 Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Christian Clauss <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 091b4bf commit 79b1f04

28 files changed

+1354
-821
lines changed
 

‎tools/gyp/DEPS

-23
This file was deleted.

‎tools/gyp/buildbot/buildbot_run.py

-137
This file was deleted.

‎tools/gyp/buildbot/commit_queue/OWNERS

-6
This file was deleted.

‎tools/gyp/buildbot/commit_queue/README

-3
This file was deleted.

‎tools/gyp/buildbot/commit_queue/cq_config.json

-15
This file was deleted.

‎tools/gyp/codereview.settings

-6
This file was deleted.

‎tools/gyp/gyp_main.py

+36-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,44 @@
66

77
import os
88
import sys
9+
import subprocess
10+
11+
PY3 = bytes != str
12+
13+
# Below IsCygwin() function copied from pylib/gyp/common.py
14+
def IsCygwin():
15+
try:
16+
out = subprocess.Popen("uname",
17+
stdout=subprocess.PIPE,
18+
stderr=subprocess.STDOUT)
19+
stdout, stderr = out.communicate()
20+
if PY3:
21+
stdout = stdout.decode("utf-8")
22+
return "CYGWIN" in str(stdout)
23+
except Exception:
24+
return False
25+
26+
27+
def UnixifyPath(path):
28+
try:
29+
if not IsCygwin():
30+
return path
31+
out = subprocess.Popen(["cygpath", "-u", path],
32+
stdout=subprocess.PIPE,
33+
stderr=subprocess.STDOUT)
34+
stdout, _ = out.communicate()
35+
if PY3:
36+
stdout = stdout.decode("utf-8")
37+
return str(stdout)
38+
except Exception:
39+
return path
40+
941

1042
# Make sure we're using the version of pylib in this repo, not one installed
11-
# elsewhere on the system.
12-
sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), 'pylib'))
43+
# elsewhere on the system. Also convert to Unix style path on Cygwin systems,
44+
# else the 'gyp' library will not be found
45+
path = UnixifyPath(sys.argv[0])
46+
sys.path.insert(0, os.path.join(os.path.dirname(path), 'pylib'))
1347
import gyp
1448

1549
if __name__ == '__main__':

0 commit comments

Comments
 (0)
Please sign in to comment.