mini_portile2 2.8.2 → 2.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8c3bc43ff4324b2780fdac7f1832759fe3933330155380eeb4d3be23a55ac25
4
- data.tar.gz: 4b9ed8985c6ae4b827b1cd9791a97a8a708fca9f02dd2bc0854e241d05ce71bf
3
+ metadata.gz: 51973caa0015d6919e11d6e081cec2e26f146cf329e5f2ec9b34b97e1485d13a
4
+ data.tar.gz: e5a8eeb01caa0e047ba7d0c75e19e726b18aa8af4fa6fc89e40367671d8bc919
5
5
  SHA512:
6
- metadata.gz: f29569cacecfd0ade1fc031add7f0e1bb7bccf3a180f260b17541d4493de809f7c4b53180ed47d159a01956318c67c16df810984e974718d0b0eeee42d789a52
7
- data.tar.gz: b93d7d34b54e9f6e3083642bc11d14720c566eac2dd745ad99004961f6a37d770349a5f4c99cd2e4ed084246025d26ca8e2fdf434d4b1837c59ae02c7173aa60
6
+ metadata.gz: 7711d008192576bddd38a396a372581cfff4e6e2ec48c95ac669c61db470bad9a9e508cf314ab6fa859069477262c1c8c7d30beb043d3ce6a571c80351ef0e79
7
+ data.tar.gz: 553bc5519d22489492ee5eb16c80048731523a1cf45e8f7eb3c2f5a29de9b0a61bfa350894cbd0a82a769c6972ddd1083deb379b262f53ea9092a6e4abb910cd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## mini_portile changelog
2
2
 
3
+ ### 2.8.3 / 2023-07-18
4
+
5
+ #### Fixed
6
+
7
+ - cmake: only use MSYS/NMake generators when available. [#129] (Thanks, @stanhu!)
8
+
9
+
3
10
  ### 2.8.2 / 2023-04-30
4
11
 
5
12
  #### Fixed
@@ -1,4 +1,5 @@
1
1
  require 'mini_portile2/mini_portile'
2
+ require 'open3'
2
3
 
3
4
  class MiniPortileCMake < MiniPortile
4
5
  def configure_prefix
@@ -11,9 +12,9 @@ class MiniPortileCMake < MiniPortile
11
12
  end
12
13
 
13
14
  def configure_defaults
14
- if MiniPortile.mswin?
15
+ if MiniPortile.mswin? && generator_available?('NMake')
15
16
  ['-G', 'NMake Makefiles']
16
- elsif MiniPortile.mingw?
17
+ elsif MiniPortile.mingw? && generator_available?('MSYS')
17
18
  ['-G', 'MSYS Makefiles']
18
19
  else
19
20
  []
@@ -48,4 +49,14 @@ class MiniPortileCMake < MiniPortile
48
49
  def cmake_cmd
49
50
  (ENV["CMAKE"] || @cmake_command || "cmake").dup
50
51
  end
52
+
53
+ private
54
+
55
+ def generator_available?(generator_type)
56
+ stdout_str, status = Open3.capture2("#{cmake_cmd} --help")
57
+
58
+ raise 'Unable to determine whether CMake supports #{generator_type} Makefile generator' unless status.success?
59
+
60
+ stdout_str.include?("#{generator_type} Makefiles")
61
+ end
51
62
  end
@@ -1,3 +1,3 @@
1
1
  class MiniPortile
2
- VERSION = "2.8.2"
2
+ VERSION = "2.8.3"
3
3
  end
data/test/test_cmake.rb CHANGED
@@ -59,7 +59,7 @@ class TestCMake < TestCase
59
59
  end
60
60
  end
61
61
 
62
- class TestCMakeConfig < TestCase
62
+ class TestCMakeConfig < TestCMake
63
63
  def test_make_command_configuration
64
64
  MiniPortile.stub(:mswin?, false) do
65
65
  without_env("MAKE") do
@@ -77,6 +77,30 @@ class TestCMakeConfig < TestCase
77
77
  end
78
78
  end
79
79
 
80
+ def test_configure_defaults_with_unix_makefiles
81
+ Open3.stub(:capture2, cmake_help_mock('Unix')) do
82
+ MiniPortile.stub(:mingw?, true) do
83
+ assert_equal([], @recipe.configure_defaults)
84
+ end
85
+ end
86
+ end
87
+
88
+ def test_configure_defaults_with_msys_makefiles
89
+ Open3.stub(:capture2, cmake_help_mock('MSYS')) do
90
+ MiniPortile.stub(:mingw?, true) do
91
+ assert_equal(['-G', 'MSYS Makefiles'], @recipe.configure_defaults)
92
+ end
93
+ end
94
+ end
95
+
96
+ def test_configure_defaults_with_nmake_makefiles
97
+ Open3.stub(:capture2, cmake_help_mock('NMake')) do
98
+ MiniPortile.stub(:mswin?, true) do
99
+ assert_equal(['-G', 'NMake Makefiles'], @recipe.configure_defaults)
100
+ end
101
+ end
102
+ end
103
+
80
104
  def test_cmake_command_configuration
81
105
  without_env("CMAKE") do
82
106
  assert_equal("cmake", MiniPortileCMake.new("test", "1.0.0").cmake_cmd)
@@ -87,4 +111,20 @@ class TestCMakeConfig < TestCase
87
111
  assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0", cmake_command: "xyzzy").cmake_cmd)
88
112
  end
89
113
  end
114
+
115
+ private
116
+
117
+ def cmake_help_mock(generator_type)
118
+ open3_mock = MiniTest::Mock.new
119
+ cmake_script = <<~SCRIPT
120
+ echo "The following generators are available on this platform (* marks default):"
121
+ echo "* #{generator_type} Makefiles = Generates standard #{generator_type.upcase} makefiles."
122
+ SCRIPT
123
+
124
+ exit_status = MiniTest::Mock.new
125
+ exit_status.expect(:success?, true)
126
+ expected_output = [cmake_script, exit_status]
127
+ open3_mock.expect(:call, expected_output, ['cmake --help'])
128
+ open3_mock
129
+ end
90
130
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_portile2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.2
4
+ version: 2.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Lavena
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-04-30 00:00:00.000000000 Z
13
+ date: 2023-07-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler