autoproj 2.13.0 → 2.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +25 -0
  3. data/.github/workflows/test.yml +30 -0
  4. data/.rubocop.yml +79 -91
  5. data/.rubocop_todo.yml +1473 -0
  6. data/Gemfile +9 -9
  7. data/Rakefile +24 -24
  8. data/autoproj.gemspec +24 -22
  9. data/bin/alocate +4 -4
  10. data/bin/alog +5 -7
  11. data/bin/amake +4 -4
  12. data/bin/aup +4 -4
  13. data/bin/autoproj +3 -3
  14. data/bin/autoproj_bootstrap +224 -199
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +223 -198
  17. data/bin/autoproj_install.in +6 -7
  18. data/lib/autoproj/aruba_minitest.rb +6 -11
  19. data/lib/autoproj/autobuild.rb +9 -6
  20. data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
  21. data/lib/autoproj/autobuild_extensions/dsl.rb +64 -34
  22. data/lib/autoproj/autobuild_extensions/git.rb +27 -26
  23. data/lib/autoproj/autobuild_extensions/package.rb +23 -22
  24. data/lib/autoproj/autobuild_extensions/python.rb +18 -0
  25. data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
  26. data/lib/autoproj/base.rb +1 -1
  27. data/lib/autoproj/bash_completion.rb +5 -6
  28. data/lib/autoproj/build_option.rb +22 -24
  29. data/lib/autoproj/cli/base.rb +26 -26
  30. data/lib/autoproj/cli/bootstrap.rb +14 -16
  31. data/lib/autoproj/cli/build.rb +10 -7
  32. data/lib/autoproj/cli/cache.rb +11 -11
  33. data/lib/autoproj/cli/clean.rb +10 -10
  34. data/lib/autoproj/cli/commit.rb +7 -8
  35. data/lib/autoproj/cli/doc.rb +2 -2
  36. data/lib/autoproj/cli/envsh.rb +1 -2
  37. data/lib/autoproj/cli/exec.rb +60 -20
  38. data/lib/autoproj/cli/inspection_tool.rb +13 -7
  39. data/lib/autoproj/cli/locate.rb +30 -41
  40. data/lib/autoproj/cli/log.rb +7 -7
  41. data/lib/autoproj/cli/main.rb +213 -204
  42. data/lib/autoproj/cli/main_doc.rb +22 -21
  43. data/lib/autoproj/cli/main_global.rb +44 -19
  44. data/lib/autoproj/cli/main_plugin.rb +18 -18
  45. data/lib/autoproj/cli/main_test.rb +28 -27
  46. data/lib/autoproj/cli/manifest.rb +7 -7
  47. data/lib/autoproj/cli/osdeps.rb +12 -11
  48. data/lib/autoproj/cli/patcher.rb +2 -3
  49. data/lib/autoproj/cli/query.rb +17 -18
  50. data/lib/autoproj/cli/reconfigure.rb +1 -2
  51. data/lib/autoproj/cli/reset.rb +9 -12
  52. data/lib/autoproj/cli/show.rb +38 -39
  53. data/lib/autoproj/cli/status.rb +45 -39
  54. data/lib/autoproj/cli/switch_config.rb +5 -6
  55. data/lib/autoproj/cli/tag.rb +12 -11
  56. data/lib/autoproj/cli/test.rb +7 -7
  57. data/lib/autoproj/cli/update.rb +35 -37
  58. data/lib/autoproj/cli/utility.rb +11 -10
  59. data/lib/autoproj/cli/version.rb +42 -40
  60. data/lib/autoproj/cli/versions.rb +14 -15
  61. data/lib/autoproj/cli/watch.rb +33 -37
  62. data/lib/autoproj/cli/which.rb +16 -20
  63. data/lib/autoproj/cli.rb +4 -2
  64. data/lib/autoproj/configuration.rb +77 -85
  65. data/lib/autoproj/default.osdeps +18 -3
  66. data/lib/autoproj/environment.rb +42 -23
  67. data/lib/autoproj/exceptions.rb +9 -3
  68. data/lib/autoproj/find_workspace.rb +20 -25
  69. data/lib/autoproj/git_server_configuration.rb +40 -44
  70. data/lib/autoproj/gitorious.rb +1 -1
  71. data/lib/autoproj/installation_manifest.rb +64 -29
  72. data/lib/autoproj/local_package_set.rb +13 -11
  73. data/lib/autoproj/manifest.rb +137 -130
  74. data/lib/autoproj/metapackage.rb +2 -6
  75. data/lib/autoproj/ops/atomic_write.rb +7 -6
  76. data/lib/autoproj/ops/build.rb +4 -6
  77. data/lib/autoproj/ops/cache.rb +41 -43
  78. data/lib/autoproj/ops/cached_env.rb +5 -4
  79. data/lib/autoproj/ops/configuration.rb +525 -507
  80. data/lib/autoproj/ops/import.rb +76 -64
  81. data/lib/autoproj/ops/install.rb +217 -191
  82. data/lib/autoproj/ops/loader.rb +77 -76
  83. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  84. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  85. data/lib/autoproj/ops/snapshot.rb +250 -247
  86. data/lib/autoproj/ops/tools.rb +76 -78
  87. data/lib/autoproj/ops/watch.rb +6 -6
  88. data/lib/autoproj/ops/which.rb +17 -14
  89. data/lib/autoproj/options.rb +13 -2
  90. data/lib/autoproj/os_package_installer.rb +102 -92
  91. data/lib/autoproj/os_package_query.rb +7 -13
  92. data/lib/autoproj/os_package_resolver.rb +189 -140
  93. data/lib/autoproj/os_repository_installer.rb +4 -4
  94. data/lib/autoproj/os_repository_resolver.rb +8 -6
  95. data/lib/autoproj/package_definition.rb +12 -13
  96. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +19 -11
  97. data/lib/autoproj/package_managers/bundler_manager.rb +186 -129
  98. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  99. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  100. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  101. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  102. data/lib/autoproj/package_managers/manager.rb +8 -3
  103. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  104. data/lib/autoproj/package_managers/pip_manager.rb +30 -28
  105. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  106. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  107. data/lib/autoproj/package_managers/shell_script_manager.rb +47 -25
  108. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  109. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  110. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  111. data/lib/autoproj/package_manifest.rb +28 -74
  112. data/lib/autoproj/package_selection.rb +187 -187
  113. data/lib/autoproj/package_set.rb +144 -113
  114. data/lib/autoproj/python.rb +297 -0
  115. data/lib/autoproj/query_base.rb +20 -14
  116. data/lib/autoproj/reporter.rb +19 -19
  117. data/lib/autoproj/repository_managers/apt.rb +102 -68
  118. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  119. data/lib/autoproj/ros_condition_parser.rb +84 -0
  120. data/lib/autoproj/ros_package_manifest.rb +125 -0
  121. data/lib/autoproj/shell_completion.rb +16 -13
  122. data/lib/autoproj/source_package_query.rb +29 -36
  123. data/lib/autoproj/system.rb +32 -21
  124. data/lib/autoproj/test.rb +127 -104
  125. data/lib/autoproj/variable_expansion.rb +7 -9
  126. data/lib/autoproj/vcs_definition.rb +35 -32
  127. data/lib/autoproj/version.rb +1 -1
  128. data/lib/autoproj/workspace.rb +142 -108
  129. data/lib/autoproj/zsh_completion.rb +8 -9
  130. data/lib/autoproj.rb +55 -55
  131. data/samples/autoproj/init.rb +1 -2
  132. metadata +80 -46
  133. data/.travis.yml +0 -24
@@ -20,14 +20,15 @@ module Autoproj
20
20
  def <=>(b)
21
21
  (0..2).inject(0) do |result, i|
22
22
  return result unless result == 0
23
- normalize(compare_fragments(self.split[i], b.split[i]))
23
+
24
+ normalize(compare_fragments(split[i], b.split[i]))
24
25
  end
25
26
  end
26
27
 
27
28
  def self.compare(a, b)
28
- new(a)<=>new(b)
29
+ new(a) <=> new(b)
29
30
  end
30
-
31
+
31
32
  private
32
33
 
33
34
  def normalize(value)
@@ -38,21 +39,21 @@ module Autoproj
38
39
 
39
40
  # Reference: https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
40
41
  def parse_version
41
- @epoch = '0'
42
- @debian_revision = '0'
42
+ @epoch = "0"
43
+ @debian_revision = "0"
43
44
 
44
- @upstream_version = @version.split(':')
45
+ @upstream_version = @version.split(":")
45
46
  if @upstream_version.size > 1
46
47
  @epoch = @upstream_version.first
47
- @upstream_version = @upstream_version[1..-1].join(':')
48
+ @upstream_version = @upstream_version[1..-1].join(":")
48
49
  else
49
50
  @upstream_version = @upstream_version.first
50
51
  end
51
52
 
52
- @upstream_version = @upstream_version.split('-')
53
+ @upstream_version = @upstream_version.split("-")
53
54
  if @upstream_version.size > 1
54
55
  @debian_revision = @upstream_version.last
55
- @upstream_version = @upstream_version[0..-2].join('-')
56
+ @upstream_version = @upstream_version[0..-2].join("-")
56
57
  else
57
58
  @upstream_version = @upstream_version.first
58
59
  end
@@ -68,15 +69,15 @@ module Autoproj
68
69
 
69
70
  def order(c)
70
71
  if digit?(c)
71
- return 0
72
+ 0
72
73
  elsif alpha?(c)
73
- return c.ord
74
- elsif c == '~'
75
- return -1
74
+ c.ord
75
+ elsif c == "~"
76
+ -1
76
77
  elsif c
77
- return c.ord + 256
78
+ c.ord + 256
78
79
  else
79
- return 0
80
+ 0
80
81
  end
81
82
  end
82
83
 
@@ -89,13 +90,14 @@ module Autoproj
89
90
  while i != a.size && j != b.size && (!digit?(a[i]) || !digit?(b[j]))
90
91
  vc = order(a[i])
91
92
  rc = order(b[j])
92
- return vc-rc if vc != rc
93
+ return vc - rc if vc != rc
94
+
93
95
  i += 1
94
96
  j += 1
95
97
  end
96
98
 
97
- i += 1 while a[i] == '0'
98
- j += 1 while b[j] == '0'
99
+ i += 1 while a[i] == "0"
100
+ j += 1 while b[j] == "0"
99
101
  while digit?(a[i]) && digit?(b[j])
100
102
  first_diff = a[i].ord - b[j].ord if first_diff == 0
101
103
  i += 1
@@ -110,12 +112,14 @@ module Autoproj
110
112
  return 0 if i == a.size && j == b.size
111
113
 
112
114
  if i == a.size
113
- return 1 if b[j] == '~'
115
+ return 1 if b[j] == "~"
116
+
114
117
  return -1
115
118
  end
116
119
  if j == b.size
117
- return -1 if a[i] == '~'
118
- return 1
120
+ return -1 if a[i] == "~"
121
+
122
+ 1
119
123
  end
120
124
  end
121
125
  end
@@ -5,10 +5,9 @@ module Autoproj
5
5
  class EmergeManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- %w{emerge},
9
- %w{emerge --noreplace})
8
+ %w[emerge],
9
+ %w[emerge --noreplace])
10
10
  end
11
11
  end
12
12
  end
13
13
  end
14
-
@@ -27,29 +27,29 @@ module Autoproj
27
27
  # of GEM_PATH
28
28
  def initialize_environment
29
29
  env = ws.env
30
- env.original_env['GEM_PATH'] =
31
- (env['GEM_PATH'] || "").split(File::PATH_SEPARATOR).find_all do |p|
30
+ env.original_env["GEM_PATH"] =
31
+ (env["GEM_PATH"] || "").split(File::PATH_SEPARATOR).find_all do |p|
32
32
  !Autoproj.in_autoproj_installation?(p)
33
33
  end.join(File::PATH_SEPARATOR)
34
- env.inherit 'GEM_PATH'
35
- env.init_from_env 'GEM_PATH'
34
+ env.inherit "GEM_PATH"
35
+ env.init_from_env "GEM_PATH"
36
36
 
37
- orig_gem_path = env.original_env['GEM_PATH'].split(File::PATH_SEPARATOR)
38
- env.system_env['GEM_PATH'] = Gem.default_path
39
- env.original_env['GEM_PATH'] = orig_gem_path.join(File::PATH_SEPARATOR)
37
+ orig_gem_path = env.original_env["GEM_PATH"].split(File::PATH_SEPARATOR)
38
+ env.system_env["GEM_PATH"] = Gem.default_path
39
+ env.original_env["GEM_PATH"] = orig_gem_path.join(File::PATH_SEPARATOR)
40
40
 
41
41
  ws.config.each_reused_autoproj_installation do |p|
42
- p_gems = File.join(p, '.gems')
42
+ p_gems = File.join(p, ".gems")
43
43
  if File.directory?(p_gems)
44
- env.push_path 'GEM_PATH', p_gems
45
- env.push_path 'PATH', File.join(p_gems, 'bin')
44
+ env.push_path "GEM_PATH", p_gems
45
+ env.push_path "PATH", File.join(p_gems, "bin")
46
46
  end
47
47
  end
48
48
 
49
- @gem_home = (ENV['AUTOPROJ_GEM_HOME'] || File.join(ws.root_dir, ".gems"))
50
- env.push_path 'GEM_PATH', gem_home
51
- env.set 'GEM_HOME', gem_home
52
- env.push_path 'PATH', "#{gem_home}/bin"
49
+ @gem_home = (ENV["AUTOPROJ_GEM_HOME"] || File.join(ws.root_dir, ".gems"))
50
+ env.push_path "GEM_PATH", gem_home
51
+ env.set "GEM_HOME", gem_home
52
+ env.push_path "PATH", "#{gem_home}/bin"
53
53
 
54
54
  # Now, reset the directories in our own RubyGems instance
55
55
  Gem.paths = env.resolved_env
@@ -59,47 +59,47 @@ module Autoproj
59
59
 
60
60
  # Override the gem home detected by {initialize_environment}, or set
61
61
  # it in cases where calling {initialize_environment} is not possible
62
- def self.gem_home=(gem_home)
63
- @gem_home = gem_home
62
+ class << self
63
+ attr_writer :gem_home
64
64
  end
65
65
 
66
66
  # A global cache directory that should be used to avoid
67
67
  # re-downloading gems
68
68
  def self.cache_dir
69
- if dir = ENV['AUTOBUILD_CACHE_DIR']
70
- dir = File.join(dir, 'gems')
71
- FileUtils.mkdir_p dir
72
- dir
73
- end
69
+ return unless (dir = ENV["AUTOBUILD_CACHE_DIR"])
70
+
71
+ dir = File.join(dir, "gems")
72
+ FileUtils.mkdir_p dir
73
+ dir
74
74
  end
75
75
 
76
76
  def self.use_cache_dir
77
77
  # If there is a cache directory, make sure .gems/cache points to
78
78
  # it (there are no programmatic ways to override this)
79
- if cache = cache_dir
80
- gem_cache_dir = File.join(gem_home, 'cache')
81
- if !File.symlink?(gem_cache_dir) || File.readlink(gem_cache_dir) != cache
82
- FileUtils.mkdir_p gem_home
83
- FileUtils.rm_rf gem_cache_dir
84
- Autoproj.create_symlink(cache, gem_cache_dir)
85
- end
79
+ return unless (cache = cache_dir)
80
+
81
+ gem_cache_dir = File.join(gem_home, "cache")
82
+ if !File.symlink?(gem_cache_dir) || File.readlink(gem_cache_dir) != cache
83
+ FileUtils.mkdir_p gem_home
84
+ FileUtils.rm_rf gem_cache_dir
85
+ Autoproj.create_symlink(cache, gem_cache_dir)
86
86
  end
87
87
  end
88
88
 
89
89
  # Return the directory in which RubyGems package should be installed
90
- def self.gem_home
91
- @gem_home
90
+ class << self
91
+ attr_reader :gem_home
92
92
  end
93
93
 
94
94
  @gem_home = nil
95
-
95
+
96
96
  # Returns the set of default options that are added to gem
97
97
  #
98
98
  # By default, we add --no-user-install to un-break distributions
99
99
  # like Arch that set --user-install by default (thus disabling the
100
100
  # role of GEM_HOME)
101
101
  def self.default_install_options
102
- @default_install_options ||= ['--no-user-install', '--no-format-executable']
102
+ @default_install_options ||= ["--no-user-install", "--no-format-executable"]
103
103
  end
104
104
 
105
105
  def initialize(ws)
@@ -115,7 +115,7 @@ module Autoproj
115
115
  attr_reader :installed_gems
116
116
 
117
117
  def gem_fetcher
118
- if !@gem_fetcher
118
+ unless @gem_fetcher
119
119
  Autoproj.message " looking for RubyGems updates"
120
120
  @gem_fetcher = Gem::SpecFetcher.fetcher
121
121
  end
@@ -123,35 +123,29 @@ module Autoproj
123
123
  end
124
124
 
125
125
  def guess_gem_program
126
- if Autobuild.programs['gem']
127
- return Autobuild.programs['gem']
128
- end
126
+ return Autobuild.programs["gem"] if Autobuild.programs["gem"]
129
127
 
130
- ruby_bin = RbConfig::CONFIG['RUBY_INSTALL_NAME']
131
- ruby_bindir = RbConfig::CONFIG['bindir']
128
+ ruby_bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"]
129
+ ruby_bindir = RbConfig::CONFIG["bindir"]
132
130
 
133
- candidates = ['gem']
134
- if ruby_bin =~ /^ruby(.+)$/
135
- candidates << "gem#{$1}"
136
- end
131
+ candidates = ["gem"]
132
+ candidates << "gem#{$1}" if ruby_bin =~ /^ruby(.+)$/
137
133
 
138
134
  candidates.each do |gem_name|
139
135
  if File.file?(gem_full_path = File.join(ruby_bindir, gem_name))
140
- Autobuild.programs['gem'] = gem_full_path
136
+ Autobuild.programs["gem"] = gem_full_path
141
137
  return
142
138
  end
143
139
  end
144
140
 
145
- raise ArgumentError, "cannot find a gem program (tried #{candidates.sort.join(", ")} in #{ruby_bindir})"
141
+ raise ArgumentError, "cannot find a gem program (tried #{candidates.sort.join(', ')} in #{ruby_bindir})"
146
142
  end
147
143
 
148
144
  def build_gem_cmdlines(gems)
149
145
  with_version, without_version = gems.partition { |name, v| v }
150
146
 
151
147
  cmdlines = []
152
- if !without_version.empty?
153
- cmdlines << without_version.flatten
154
- end
148
+ cmdlines << without_version.flatten unless without_version.empty?
155
149
  with_version.each do |name, v|
156
150
  cmdlines << [name, "-v", v]
157
151
  end
@@ -160,17 +154,17 @@ module Autoproj
160
154
 
161
155
  def pristine(gems)
162
156
  guess_gem_program
163
- base_cmdline = [Autobuild.tool_in_path('ruby', env: ws.env), '-S', Autobuild.tool('gem')]
157
+ base_cmdline = [Autobuild.tool_in_path("ruby", env: ws.env), "-S", Autobuild.tool("gem")]
164
158
  cmdlines = [
165
- [*base_cmdline, 'clean'],
159
+ [*base_cmdline, "clean"]
166
160
  ]
167
161
  cmdlines += build_gem_cmdlines(gems).map do |line|
168
162
  base_cmdline + ["pristine", "--extensions"] + line
169
163
  end
170
164
  if gems_interaction(gems, cmdlines)
171
- Autoproj.message " restoring RubyGems: #{gems.map { |g| g.join(" ") }.sort.join(", ")}"
165
+ Autoproj.message " restoring RubyGems: #{gems.map { |g| g.join(' ') }.sort.join(', ')}"
172
166
  cmdlines.each do |c|
173
- Autobuild::Subprocess.run 'autoproj', 'osdeps', *c
167
+ Autobuild::Subprocess.run "autoproj", "osdeps", *c
174
168
  end
175
169
  end
176
170
  end
@@ -178,25 +172,21 @@ module Autoproj
178
172
  def install(gems)
179
173
  guess_gem_program
180
174
 
181
- base_cmdline = [Autobuild.tool_in_path('ruby', env: ws.env), '-S', Autobuild.tool('gem'), 'install', *GemManager.default_install_options]
182
- if !GemManager.with_doc
183
- base_cmdline << '--no-rdoc' << '--no-ri'
184
- end
175
+ base_cmdline = [Autobuild.tool_in_path("ruby", env: ws.env), "-S", Autobuild.tool("gem"), "install", *GemManager.default_install_options]
176
+ base_cmdline << "--no-rdoc" << "--no-ri" unless GemManager.with_doc
185
177
 
186
- if GemManager.with_prerelease
187
- base_cmdline << "--prerelease"
188
- end
178
+ base_cmdline << "--prerelease" if GemManager.with_prerelease
189
179
 
190
180
  cmdlines = build_gem_cmdlines(gems).map do |line|
191
181
  base_cmdline + line
192
182
  end
193
183
  if gems_interaction(gems, cmdlines)
194
- Autoproj.message " installing/updating RubyGems dependencies: #{gems.map { |g| g.join(" ") }.sort.join(", ")}"
184
+ Autoproj.message " installing/updating RubyGems dependencies: #{gems.map { |g| g.join(' ') }.sort.join(', ')}"
195
185
 
196
186
  cmdlines.each do |c|
197
- Autobuild::Subprocess.run 'autoproj', 'osdeps', *c,
198
- env: Hash['GEM_HOME' => Gem.paths.home,
199
- 'GEM_PATH' => Gem.paths.path.join(":")]
187
+ Autobuild::Subprocess.run "autoproj", "osdeps", *c,
188
+ env: Hash["GEM_HOME" => Gem.paths.home,
189
+ "GEM_PATH" => Gem.paths.path.join(":")]
200
190
  end
201
191
  gems.each do |name, v|
202
192
  installed_gems << name
@@ -209,14 +199,14 @@ module Autoproj
209
199
  # installed, or that can be upgraded
210
200
  def filter_uptodate_packages(gems, options = Hash.new)
211
201
  options = validate_options options,
212
- install_only: !Autobuild.do_update
202
+ install_only: !Autobuild.do_update
213
203
 
214
204
  # Don't install gems that are already there ...
215
205
  gems = gems.dup
216
206
  gems.delete_if do |name, version|
217
207
  next(true) if installed_gems.include?(name)
218
208
 
219
- version_requirements = Gem::Requirement.new(version || '>= 0')
209
+ version_requirements = Gem::Requirement.new(version || ">= 0")
220
210
  installed =
221
211
  if Gem::Specification.respond_to?(:find_by_name)
222
212
  begin
@@ -236,14 +226,16 @@ module Autoproj
236
226
  non_prerelease = gem_fetcher.find_matching(dep, true, true).map(&:first)
237
227
  if GemManager.with_prerelease
238
228
  prerelease = gem_fetcher.find_matching(dep, false, true, true).map(&:first)
239
- else prerelease = Array.new
229
+ else
230
+ prerelease = Array.new
240
231
  end
241
- (non_prerelease + prerelease).
242
- map { |n, v, _| [n, v] }
232
+ (non_prerelease + prerelease)
233
+ .map { |n, v, _| [n, v] }
243
234
 
244
235
  else # Post RubyGems-2.0
245
236
  type = if GemManager.with_prerelease then :complete
246
- else :released
237
+ else
238
+ :released
247
239
  end
248
240
 
249
241
  gem_fetcher.detect(type) do |tuple|
@@ -252,7 +244,7 @@ module Autoproj
252
244
  end
253
245
  installed_version = installed.map(&:version).max
254
246
  available_version = available.map { |_, v| v }.max
255
- if !available_version
247
+ unless available_version
256
248
  if version
257
249
  raise ConfigError.new, "cannot find any gem with the name '#{name}' and version #{version}"
258
250
  else
@@ -288,22 +280,22 @@ module Autoproj
288
280
  # We're not supposed to install rubygem packages but silent is not
289
281
  # set, so display information about them anyway
290
282
  puts <<-EOMSG
291
- #{Autoproj.color("The build process and/or the packages require some Ruby Gems to be installed", :bold)}
292
- #{Autoproj.color("and you required autoproj to not do it itself", :bold)}
283
+ #{Autoproj.color('The build process and/or the packages require some Ruby Gems to be installed', :bold)}
284
+ #{Autoproj.color('and you required autoproj to not do it itself', :bold)}
293
285
  You can use the --all or --ruby options to autoproj osdeps to install these
294
286
  packages anyway, and/or change to the osdeps handling mode by running an
295
287
  autoproj operation with the --reconfigure option as for instance
296
288
  autoproj build --reconfigure
297
-
289
+ #{' '}
298
290
  The following command line can be used to install them manually
299
-
300
- #{cmdlines.map { |c| c.join(" ") }.join("\n ")}
301
-
291
+ #{' '}
292
+ #{cmdlines.map { |c| c.join(' ') }.join("\n ")}
293
+ #{' '}
302
294
  Autoproj expects these Gems to be installed in #{GemManager.gem_home} This can
303
295
  be overridden by setting the AUTOPROJ_GEM_HOME environment variable manually
304
296
 
305
297
  EOMSG
306
- print " #{Autoproj.color("Press ENTER to continue ", :bold)}"
298
+ print " #{Autoproj.color('Press ENTER to continue ', :bold)}"
307
299
 
308
300
  STDOUT.flush
309
301
  STDIN.readline
@@ -313,4 +305,3 @@ module Autoproj
313
305
  end
314
306
  end
315
307
  end
316
-
@@ -5,8 +5,8 @@ module Autoproj
5
5
  class HomebrewManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- %w{brew install},
9
- %w{brew install},
8
+ %w[brew install],
9
+ %w[brew install],
10
10
  false)
11
11
  end
12
12
 
@@ -16,7 +16,7 @@ module Autoproj
16
16
  packages = packages.uniq
17
17
  command_line = "brew info --json=v1 #{packages.join(' ')}"
18
18
  result = Autoproj.bundler_with_unbundled_env do
19
- (Autobuild::Subprocess.run 'autoproj', 'osdeps', command_line).first
19
+ (Autobuild::Subprocess.run "autoproj", "osdeps", command_line).first
20
20
  end
21
21
 
22
22
  begin
@@ -53,4 +53,3 @@ module Autoproj
53
53
  end
54
54
  end
55
55
  end
56
-
@@ -11,10 +11,16 @@ module Autoproj
11
11
  attr_reader :ws
12
12
 
13
13
  attr_writer :enabled
14
- def enabled?; !!@enabled end
14
+
15
+ def enabled?
16
+ !!@enabled
17
+ end
15
18
 
16
19
  attr_writer :silent
17
- def silent?; !!@silent end
20
+
21
+ def silent?
22
+ !!@silent
23
+ end
18
24
 
19
25
  # Whether this package manager should be called even if no packages
20
26
  # should be installed
@@ -68,4 +74,3 @@ module Autoproj
68
74
  end
69
75
  end
70
76
  end
71
-
@@ -5,10 +5,9 @@ module Autoproj
5
5
  class PacmanManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- %w{pacman -Sy --needed},
9
- %w{pacman -Sy --needed --noconfirm})
8
+ %w[pacman -Sy --needed],
9
+ %w[pacman -Sy --needed --noconfirm])
10
10
  end
11
11
  end
12
12
  end
13
13
  end
14
-
@@ -1,3 +1,5 @@
1
+ require "autoproj/python"
2
+
1
3
  module Autoproj
2
4
  module PackageManagers
3
5
  # Using pip to install python packages
@@ -5,14 +7,14 @@ module Autoproj
5
7
  attr_reader :installed_pips
6
8
 
7
9
  def initialize_environment
8
- ws.env.set 'PYTHONUSERBASE', pip_home
9
- ws.env.add_path 'PATH', File.join(pip_home, 'bin')
10
+ ws.env.set "PYTHONUSERBASE", pip_home
11
+ ws.env.add_path "PATH", File.join(pip_home, "bin")
10
12
  end
11
13
 
12
14
  # Return the directory where python packages are installed to.
13
15
  # The actual path is pip_home/lib/pythonx.y/site-packages.
14
16
  def pip_home
15
- ws.env['AUTOPROJ_PYTHONUSERBASE'] || File.join(ws.prefix_dir, "pip")
17
+ ws.env["AUTOPROJ_PYTHONUSERBASE"] || File.join(ws.prefix_dir, "pip")
16
18
  end
17
19
 
18
20
  def initialize(ws)
@@ -21,34 +23,35 @@ module Autoproj
21
23
  end
22
24
 
23
25
  def os_dependencies
24
- super + ['pip']
26
+ super + ["pip"]
25
27
  end
26
28
 
27
29
  def guess_pip_program
28
- if Autobuild.programs['pip']
29
- return Autobuild.programs['pip']
30
- end
30
+ activate_python
31
+ Autobuild.programs["pip"] = "pip" unless Autobuild.programs["pip"]
32
+ Autobuild.programs["pip"]
33
+ end
31
34
 
32
- Autobuild.programs['pip'] = "pip"
35
+ def activate_python
36
+ Autoproj::Python.setup_python_configuration_options(ws: ws)
37
+ Autoproj::Python.assert_python_activated(ws: ws)
33
38
  end
34
39
 
35
40
  def install(pips, filter_uptodate_packages: false, install_only: false)
36
41
  guess_pip_program
37
- if pips.is_a?(String)
38
- pips = [pips]
39
- end
42
+ pips = [pips] if pips.is_a?(String)
40
43
 
41
- base_cmdline = [Autobuild.tool('pip'), 'install','--user']
44
+ base_cmdline = [Autobuild.tool("pip"), "install", "--user"]
42
45
 
43
46
  cmdlines = [base_cmdline + pips]
44
47
 
45
- if pips_interaction(pips, cmdlines)
46
- Autoproj.message " installing/updating Python dependencies: "+
47
- "#{pips.sort.join(", ")}"
48
+ if pips_interaction(cmdlines)
49
+ Autoproj.message " installing/updating Python dependencies:" \
50
+ " #{pips.sort.join(', ')}"
48
51
 
49
52
  cmdlines.each do |c|
50
- Autobuild::Subprocess.run 'autoproj', 'osdeps', *c,
51
- env: ws.env.resolved_env
53
+ Autobuild::Subprocess.run "autoproj", "osdeps", *c,
54
+ env: ws.env.resolved_env
52
55
  end
53
56
 
54
57
  pips.each do |p|
@@ -56,8 +59,8 @@ module Autoproj
56
59
  end
57
60
  end
58
61
  end
59
-
60
- def pips_interaction(pips, cmdlines)
62
+
63
+ def pips_interaction(cmdlines)
61
64
  if OSPackageInstaller.force_osdeps
62
65
  return true
63
66
  elsif enabled?
@@ -69,24 +72,23 @@ module Autoproj
69
72
  # We're not supposed to install rubygem packages but silent is not
70
73
  # set, so display information about them anyway
71
74
  puts <<-EOMSG
72
- #{Autoproj.color("The build process and/or the packages require some Python packages to be installed", :bold)}
73
- #{Autoproj.color("and you required autoproj to not do it itself", :bold)}
75
+ #{Autoproj.color('The build process and/or the packages require some Python packages to be installed', :bold)}
76
+ #{Autoproj.color('and you required autoproj to not do it itself', :bold)}
74
77
  The following command line can be used to install them manually
75
-
76
- #{cmdlines.map { |c| c.join(" ") }.join("\n ")}
77
-
78
+ #{' '}
79
+ #{cmdlines.map { |c| c.join(' ') }.join("\n ")}
80
+ #{' '}
78
81
  Autoproj expects these Python packages to be installed in #{pip_home} This can
79
82
  be overridden by setting the AUTOPROJ_PYTHONUSERBASE environment variable manually
80
83
 
81
84
  EOMSG
82
- print " #{Autoproj.color("Press ENTER to continue ", :bold)}"
85
+ print " #{Autoproj.color('Press ENTER to continue ', :bold)}"
83
86
 
84
- STDOUT.flush
85
- STDIN.readline
87
+ $stdout.flush
88
+ $stdin.readline
86
89
  puts
87
90
  false
88
91
  end
89
92
  end
90
93
  end
91
94
  end
92
-
@@ -1,14 +1,13 @@
1
1
  module Autoproj
2
2
  module PackageManagers
3
- # Package manager interface for systems that use pkg (i.e. FreeBSD) as
3
+ # Package manager interface for systems that use pkg (i.e. FreeBSD) as
4
4
  # their package manager
5
5
  class PkgManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- %w{pkg install -y},
9
- %w{pkg install -y})
8
+ %w[pkg install -y],
9
+ %w[pkg install -y])
10
10
  end
11
11
  end
12
12
  end
13
13
  end
14
-
@@ -5,10 +5,9 @@ module Autoproj
5
5
  class PortManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- %w{port install},
9
- %w{port install})
8
+ %w[port install],
9
+ %w[port install])
10
10
  end
11
11
  end
12
12
  end
13
13
  end
14
-