From 4ae8d204cbb18829218e3987c8fd59803f4ccab0 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 27 Jun 2019 14:39:15 -0700 Subject: [PATCH] tools: move python code out of jenkins shell https://ci.nodejs.org/job/node-test-commit-v8-linux/configure echoes python code into tools and runs it. Move these scripts into tools for better maintainability. Once this lands and is back-ported into LTS branches a bunch of shell code can be deleted from the job. PR-URL: https://github.com/nodejs/node/pull/28458 Reviewed-By: Richard Lau Reviewed-By: Michael Dawson Reviewed-By: Rich Trott --- tools/getarch.py | 10 ++++++++++ tools/getendian.py | 4 ++++ tools/getmachine.py | 3 +++ tools/getnodeversion.py | 1 + 4 files changed, 18 insertions(+) create mode 100644 tools/getarch.py create mode 100644 tools/getendian.py create mode 100644 tools/getmachine.py diff --git a/tools/getarch.py b/tools/getarch.py new file mode 100644 index 00000000000000..3c366525463340 --- /dev/null +++ b/tools/getarch.py @@ -0,0 +1,10 @@ +from __future__ import print_function +from utils import GuessArchitecture +arch = GuessArchitecture() + +# assume 64 bit unless set specifically +print(GuessArchitecture() \ + .replace('ia32', 'x64') \ + .replace('ppc', 'ppc64') \ + .replace('arm', 'arm64') \ + .replace('s390', 's390x')) diff --git a/tools/getendian.py b/tools/getendian.py new file mode 100644 index 00000000000000..0f9fcc1c860584 --- /dev/null +++ b/tools/getendian.py @@ -0,0 +1,4 @@ +from __future__ import print_function +import sys +# "little" or "big" +print(sys.byteorder) diff --git a/tools/getmachine.py b/tools/getmachine.py new file mode 100644 index 00000000000000..046d8b17a797fd --- /dev/null +++ b/tools/getmachine.py @@ -0,0 +1,3 @@ +from __future__ import print_function +import platform +print(platform.machine()) diff --git a/tools/getnodeversion.py b/tools/getnodeversion.py index 59f8aabe49eceb..c9f82160c0f386 100644 --- a/tools/getnodeversion.py +++ b/tools/getnodeversion.py @@ -1,3 +1,4 @@ +from __future__ import print_function import os import re