From 4cd77dc6eb3e7d7844d36de0ba3ab96e9edfc2ea Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Thu, 13 May 2021 12:53:17 +0200 Subject: [PATCH] gyp: update for python sys.platform changes --- gyp-git/0001-msys-ize.patch | 208 +----------------------------------- gyp-git/PKGBUILD | 9 +- 2 files changed, 8 insertions(+), 209 deletions(-) diff --git a/gyp-git/0001-msys-ize.patch b/gyp-git/0001-msys-ize.patch index d71ddab4..0952855e 100644 --- a/gyp-git/0001-msys-ize.patch +++ b/gyp-git/0001-msys-ize.patch @@ -1,96 +1,6 @@ -From a5776eadcc30f6de25191d37752871fb1af86c2f Mon Sep 17 00:00:00 2001 -From: "atom.long" -Date: Thu, 25 May 2017 21:37:00 +0800 -Subject: [PATCH] msys-ize - ---- - gyptest.py | 1 + - pylib/gyp/MSVSVersion.py | 4 ++-- - pylib/gyp/__init__.py | 4 ++-- - pylib/gyp/common.py | 1 + - pylib/gyp/generator/make.py | 5 ++++- - pylib/gyp/generator/ninja.py | 2 +- - test/actions-multiple/gyptest-all.py | 2 +- - test/lib/TestCommon.py | 2 +- - test/lib/TestGyp.py | 6 +++--- - test/library_dirs/gyptest-library-dirs.py | 2 +- - test/rules/src/external/external.gyp | 2 +- - test/target/gyptest-target.py | 2 +- - 12 files changed, 19 insertions(+), 14 deletions(-) - -diff --git a/gyptest.py b/gyptest.py -index 98957e1..4469795 100755 ---- a/gyptest.py -+++ b/gyptest.py -@@ -100,6 +100,7 @@ def main(argv=None): - 'freebsd8': ['make'], - 'openbsd5': ['make'], - 'cygwin': ['msvs'], -+ 'msys': ['msvs'], - 'win32': ['msvs', 'ninja'], - 'linux': ['make', 'ninja'], - 'linux2': ['make', 'ninja'], -diff --git a/pylib/gyp/MSVSVersion.py b/pylib/gyp/MSVSVersion.py -index edaf6ee..c815350 100644 ---- a/pylib/gyp/MSVSVersion.py -+++ b/pylib/gyp/MSVSVersion.py -@@ -131,7 +131,7 @@ def _RegistryQueryBase(sysdir, key, value): - stdout from reg.exe, or None for failure. - """ - # Skip if not on Windows or Python Win32 setup issue -- if sys.platform not in ('win32', 'cygwin'): -+ if sys.platform not in ('win32', 'cygwin', 'msys'): - return None - # Setup params to pass to and attempt to launch reg.exe - cmd = [os.path.join(os.environ.get('WINDIR', ''), sysdir, 'reg.exe'), -@@ -335,7 +335,7 @@ def _CreateVersion(name, path, sdk_based=False): - - def _ConvertToCygpath(path): - """Convert to cygwin path if we are using cygwin.""" -- if sys.platform == 'cygwin': -+ if sys.platform in ('cygwin', 'msys'): - p = subprocess.Popen(['cygpath', path], stdout=subprocess.PIPE) - path = p.communicate()[0].strip() - return path -diff --git a/pylib/gyp/__init__.py b/pylib/gyp/__init__.py -index 668f38b..1c14c59 100755 ---- a/pylib/gyp/__init__.py -+++ b/pylib/gyp/__init__.py -@@ -360,7 +360,7 @@ def gyp_main(args): - - if not home_dot_gyp: - home_vars = ['HOME'] -- if sys.platform in ('cygwin', 'win32'): -+ if sys.platform in ('cygwin', 'msys', 'win32'): - home_vars.append('USERPROFILE') - for home_var in home_vars: - home = os.getenv(home_var) -@@ -389,7 +389,7 @@ def gyp_main(args): - # Nothing in the variable, default based on platform. - if sys.platform == 'darwin': - options.formats = ['xcode'] -- elif sys.platform in ('win32', 'cygwin'): -+ elif sys.platform in ('win32', 'cygwin', 'msys'): - options.formats = ['msvs'] - else: - options.formats = ['make'] -diff --git a/pylib/gyp/common.py b/pylib/gyp/common.py -index a1e1db5..ca60f58 100644 ---- a/pylib/gyp/common.py -+++ b/pylib/gyp/common.py -@@ -411,6 +411,7 @@ def GetFlavor(params): - """Returns |params.flavor| if it's set, the system's default flavor else.""" - flavors = { - 'cygwin': 'win', -+ 'msys': 'win', - 'win32': 'win', - 'darwin': 'mac', - } -diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py -index e80ebae..e1907a0 100644 ---- a/pylib/gyp/generator/make.py -+++ b/pylib/gyp/generator/make.py -@@ -1355,7 +1355,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD +--- gyp/pylib/gyp/generator/make.py.orig 2021-05-13 12:43:49.416056500 +0200 ++++ gyp/pylib/gyp/generator/make.py 2021-05-13 12:44:38.698110700 +0200 +@@ -1375,7 +1375,10 @@ if self.flavor == 'aix': target_ext = '.a' else: @@ -102,115 +12,3 @@ index e80ebae..e1907a0 100644 elif self.type == 'none': target = '%s.stamp' % target elif self.type != 'executable': -diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py -index 0555a4a..c5f2276 100644 ---- a/pylib/gyp/generator/ninja.py -+++ b/pylib/gyp/generator/ninja.py -@@ -1747,7 +1747,7 @@ def GetDefaultConcurrentLinks(): - if pool_size: - return pool_size - -- if sys.platform in ('win32', 'cygwin'): -+ if sys.platform in ('win32', 'cygwin', 'msys'): - import ctypes - - class MEMORYSTATUSEX(ctypes.Structure): -diff --git a/test/actions-multiple/gyptest-all.py b/test/actions-multiple/gyptest-all.py -index 2a083de..30b7339 100755 ---- a/test/actions-multiple/gyptest-all.py -+++ b/test/actions-multiple/gyptest-all.py -@@ -35,7 +35,7 @@ if test.format in ['make', 'ninja']: - if test.format == 'make': - target = 'multi2.txt' - elif test.format == 'ninja': -- if sys.platform in ['win32', 'cygwin']: -+ if sys.platform in ('win32', 'cygwin', 'msys'): - target = '..\\..\\multi2.txt' - else: - target = '../../multi2.txt' -diff --git a/test/lib/TestCommon.py b/test/lib/TestCommon.py -index 2f526a6..5dc7b3a 100644 ---- a/test/lib/TestCommon.py -+++ b/test/lib/TestCommon.py -@@ -127,7 +127,7 @@ if sys.platform == 'win32': - dll_suffix = '.dll' - module_prefix = '' - module_suffix = '.dll' --elif sys.platform == 'cygwin': -+elif sys.platform in ('cygwin', 'msys'): - exe_suffix = '.exe' - obj_suffix = '.o' - shobj_suffix = '.os' -diff --git a/test/lib/TestGyp.py b/test/lib/TestGyp.py -index e7a522c..54de5de 100644 ---- a/test/lib/TestGyp.py -+++ b/test/lib/TestGyp.py -@@ -625,7 +625,7 @@ class TestGypMake(TestGypBase): - - def ConvertToCygpath(path): - """Convert to cygwin path if we are using cygwin.""" -- if sys.platform == 'cygwin': -+ if sys.platform in ('cygwin', 'msys'): - p = subprocess.Popen(['cygpath', path], stdout=subprocess.PIPE) - path = p.communicate()[0].strip() - return path -@@ -759,7 +759,7 @@ class TestGypOnMSToolchain(TestGypBase): - - def initialize_build_tool(self): - super(TestGypOnMSToolchain, self).initialize_build_tool() -- if sys.platform in ('win32', 'cygwin'): -+ if sys.platform in ('win32', 'cygwin', 'msys'): - build_tools = FindVisualStudioInstallation() - self.devenv_path, self.uses_msbuild, self.msbuild_path = build_tools - self.vsvars_path = TestGypOnMSToolchain._ComputeVsvarsPath( -@@ -768,7 +768,7 @@ class TestGypOnMSToolchain(TestGypBase): - def run_dumpbin(self, *dumpbin_args): - """Run the dumpbin tool with the specified arguments, and capturing and - returning stdout.""" -- assert sys.platform in ('win32', 'cygwin') -+ assert sys.platform in ('win32', 'cygwin', 'msys') - cmd = os.environ.get('COMSPEC', 'cmd.exe') - arguments = [cmd, '/c', self.vsvars_path, '&&', 'dumpbin'] - arguments.extend(dumpbin_args) -diff --git a/test/library_dirs/gyptest-library-dirs.py b/test/library_dirs/gyptest-library-dirs.py -index e725dd1..d0f1a20 100644 ---- a/test/library_dirs/gyptest-library-dirs.py -+++ b/test/library_dirs/gyptest-library-dirs.py -@@ -31,7 +31,7 @@ expect = """Hello world - test.run_built_executable( - 'libraries-search-path-test', chdir='subdir', stdout=expect) - --if sys.platform in ('win32', 'cygwin'): -+if sys.platform in ('win32', 'cygwin', 'msys'): - test.run_gyp('test-win.gyp', - '-D', - 'abs_path_to_secret_library_location={0}'.format(lib_dir), -diff --git a/test/rules/src/external/external.gyp b/test/rules/src/external/external.gyp -index b28174f..335af69 100644 ---- a/test/rules/src/external/external.gyp -+++ b/test/rules/src/external/external.gyp -@@ -19,7 +19,7 @@ - 'conditions': [ - ['OS=="win"', { - 'dependencies': [ -- 'cygwin', -+ 'msys', - ], - }], - ], -diff --git a/test/target/gyptest-target.py b/test/target/gyptest-target.py -index 4338db7..fb400ed 100644 ---- a/test/target/gyptest-target.py -+++ b/test/target/gyptest-target.py -@@ -13,7 +13,7 @@ target_extension is used to avoid MSB8012 for msvs. - import sys - import TestGyp - --if sys.platform in ('win32', 'cygwin'): -+if sys.platform in ('win32', 'cygwin', 'msys'): - test = TestGyp.TestGyp() - - test.run_gyp('target.gyp') --- -2.10.1.windows.1 - diff --git a/gyp-git/PKGBUILD b/gyp-git/PKGBUILD index 4462f3e4..f39b9964 100644 --- a/gyp-git/PKGBUILD +++ b/gyp-git/PKGBUILD @@ -4,7 +4,7 @@ _realname=gyp pkgname=${_realname}-git pkgver=r2163.caa60026 -pkgrel=1 +pkgrel=2 pkgdesc="GYP can Generate Your Projects" url="https://code.google.com/p/gyp/" arch=('i686' 'x86_64') @@ -18,16 +18,17 @@ _commit="caa60026e223fc501e8b337fd5086ece4028b1c6" source=("git+https://chromium.googlesource.com/external/gyp#commit=${_commit}" '0001-msys-ize.patch') sha256sums=('SKIP' - 'df62802ca323c257b5523437cd2229e432d87d87fc0bf8eeb626eeb5d43f1421') + 'fc53fc2f49ce1895c13aa330c814db29288a445e87a47d7bc81f6a6ab400df5f') pkgver() { cd "${srcdir}"/${_realname} - printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short "${_commit}")" + printf "r%s.%s" $(("$(git rev-list --count ${_commit})" + 1)) "$(git rev-parse --short "${_commit}")" } prepare() { cd "${srcdir}"/${_realname} - git am --committer-date-is-author-date "${srcdir}"/0001-msys-ize.patch + + patch -Np1 -i "${srcdir}/0001-msys-ize.patch" } package() {