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
@@ -1,20 +1,19 @@
1
1
  #! /usr/bin/ruby
2
2
 
3
- if RUBY_VERSION < "2.3.0"
4
- STDERR.puts "autoproj requires Ruby >= 2.3.0"
3
+ if RUBY_VERSION < "2.5.0"
4
+ STDERR.puts "autoproj requires Ruby >= 2.5.0"
5
5
  exit 1
6
- elsif ENV['AUTOPROJ_CURRENT_ROOT'] && (ENV['AUTOPROJ_CURRENT_ROOT'] != Dir.pwd)
6
+ elsif ENV["AUTOPROJ_CURRENT_ROOT"] && (ENV["AUTOPROJ_CURRENT_ROOT"] != Dir.pwd)
7
7
  STDERR.puts "it seems that you've already loaded an env.sh script in this console, open a new console and try again"
8
8
  exit 1
9
9
  end
10
10
 
11
11
  require 'autoproj/ops/install'
12
-
13
- ENV.delete('BUNDLE_GEMFILE')
14
- ENV.delete('RUBYLIB')
12
+ ENV.delete("BUNDLE_GEMFILE")
13
+ ENV.delete("RUBYLIB")
15
14
  ops = Autoproj::Ops::Install.new(Dir.pwd)
16
15
 
17
- existing_config = File.join(Dir.pwd, '.autoproj', 'config.yml')
16
+ existing_config = File.join(Dir.pwd, ".autoproj", "config.yml")
18
17
  if File.file?(existing_config)
19
18
  puts "Found existing configuration, using it as seed"
20
19
  puts "use --no-seed-config to avoid this behavior"
@@ -1,4 +1,4 @@
1
- require 'aruba/api'
1
+ require "aruba/api"
2
2
 
3
3
  module Autoproj
4
4
  # Minitest-usable Aruba wrapper
@@ -27,10 +27,10 @@ module Autoproj
27
27
 
28
28
  def generate_local_gemfile
29
29
  path = expand_path("Gemfile.local")
30
- File.open(path, 'w') do |io|
30
+ File.open(path, "w") do |io|
31
31
  io.write <<~GEMFILE
32
32
  source "https://rubygems.org"
33
- gem "autoproj", path: "#{File.expand_path("../../", __dir__)}"
33
+ gem "autoproj", path: "#{File.expand_path('../../', __dir__)}"
34
34
  GEMFILE
35
35
  end
36
36
  path
@@ -39,9 +39,7 @@ module Autoproj
39
39
  def run_command_and_stop(*args, fail_on_error: true, **kwargs)
40
40
  cmd = run_command(*args, **kwargs)
41
41
  cmd.stop
42
- if fail_on_error
43
- assert_command_finished_successfully(cmd)
44
- end
42
+ assert_command_finished_successfully(cmd) if fail_on_error
45
43
  cmd
46
44
  end
47
45
 
@@ -59,7 +57,7 @@ module Autoproj
59
57
 
60
58
  def method_missing(m, *args, &block)
61
59
  if @aruba_api.respond_to?(m)
62
- return @aruba_api.send(m, *args, &block)
60
+ @aruba_api.send(m, *args, &block)
63
61
  else
64
62
  super
65
63
  end
@@ -67,9 +65,7 @@ module Autoproj
67
65
 
68
66
  def assert_command_stops(cmd, fail_on_error: true)
69
67
  cmd.stop
70
- if fail_on_error
71
- assert_command_finished_successfully(cmd)
72
- end
68
+ assert_command_finished_successfully(cmd) if fail_on_error
73
69
  end
74
70
 
75
71
  def assert_command_finished_successfully(cmd)
@@ -78,4 +74,3 @@ module Autoproj
78
74
  end
79
75
  end
80
76
  end
81
-
@@ -1,8 +1,9 @@
1
- require 'autoproj/autobuild_extensions/package'
2
- require 'autoproj/autobuild_extensions/archive_importer'
3
- require 'autoproj/autobuild_extensions/git'
4
- require 'autoproj/autobuild_extensions/svn'
5
- require 'autoproj/autobuild_extensions/dsl'
1
+ require "autoproj/autobuild_extensions/package"
2
+ require "autoproj/autobuild_extensions/python"
3
+ require "autoproj/autobuild_extensions/archive_importer"
4
+ require "autoproj/autobuild_extensions/git"
5
+ require "autoproj/autobuild_extensions/svn"
6
+ require "autoproj/autobuild_extensions/dsl"
6
7
 
7
8
  Autobuild::Package.class_eval do
8
9
  prepend Autoproj::AutobuildExtensions::Package
@@ -16,4 +17,6 @@ end
16
17
  Autobuild::SVN.class_eval do
17
18
  prepend Autoproj::AutobuildExtensions::SVN
18
19
  end
19
-
20
+ Autobuild::Python.class_eval do
21
+ prepend Autoproj::AutobuildExtensions::Python
22
+ end
@@ -9,36 +9,35 @@ module Autoproj
9
9
  # manifest
10
10
  def pick_from_autoproj_root(package, installation_manifest)
11
11
  # Get the cachefile w.r.t. the autoproj root
12
- cachefile = Pathname.new(self.cachefile).
13
- relative_path_from(Pathname.new(ws.root_dir)).to_s
12
+ cachefile = Pathname.new(self.cachefile)
13
+ .relative_path_from(Pathname.new(ws.root_dir)).to_s
14
14
 
15
15
  # The cachefile in the other autoproj installation
16
16
  other_cachefile = File.join(installation_manifest.path, cachefile)
17
17
  if File.file?(other_cachefile)
18
- self.relocate("file://" + other_cachefile)
18
+ relocate("file://#{other_cachefile}")
19
19
  true
20
20
  end
21
21
  end
22
22
 
23
23
  def snapshot(package, target_dir = nil, options = Hash.new)
24
24
  result = Hash[
25
- 'mode' => mode,
26
- 'no_subdirectory' => !has_subdirectory?,
27
- 'archive_dir' => archive_dir || tardir]
25
+ "mode" => mode,
26
+ "no_subdirectory" => !has_subdirectory?,
27
+ "archive_dir" => archive_dir || tardir]
28
28
 
29
29
  if target_dir
30
- archive_dir = File.join(target_dir, 'archives')
30
+ archive_dir = File.join(target_dir, "archives")
31
31
  FileUtils.mkdir_p archive_dir
32
32
  FileUtils.cp @cachefile, archive_dir
33
33
 
34
- result['url'] = "file://$AUTOPROJ_SOURCE_DIR/archives/#{File.basename(@cachefile)}"
34
+ result["url"] = "file://$AUTOPROJ_SOURCE_DIR/archives/#{File.basename(@cachefile)}"
35
35
  else
36
- result['url'] = @url.to_s
36
+ result["url"] = @url.to_s
37
37
  end
38
-
38
+
39
39
  result
40
40
  end
41
41
  end
42
42
  end
43
43
  end
44
-
@@ -1,7 +1,7 @@
1
- require 'find'
2
- require 'fileutils'
3
- require 'autobuild'
4
- require 'set'
1
+ require "find"
2
+ require "fileutils"
3
+ require "autobuild"
4
+ require "set"
5
5
 
6
6
  module Autoproj
7
7
  # @deprecated use Workspace.config.ruby_executable instead, or
@@ -20,6 +20,28 @@ module Autoproj
20
20
  end
21
21
  end
22
22
 
23
+ class << self
24
+ attr_writer :custom_package_handlers
25
+
26
+ def custom_package_handlers
27
+ @custom_package_handlers ||= []
28
+ end
29
+ end
30
+
31
+ def self.each_custom_package_handler(&block)
32
+ return enum_for(__method__) unless block_given?
33
+
34
+ custom_package_handlers.each do |handler|
35
+ block.call(handler)
36
+ end
37
+ end
38
+
39
+ # Registers a block that will be called to determine a package
40
+ # handler for the package in full_path.
41
+ def self.custom_package_handler(&block)
42
+ custom_package_handlers << block
43
+ end
44
+
23
45
  # @api private
24
46
  #
25
47
  # Helper method that extracts the package name from a Rake-style package
@@ -68,11 +90,11 @@ module Autoproj
68
90
  def self.define(package_type, spec, &block)
69
91
  Autoproj.warn_deprecated(
70
92
  __method__, "use Autoproj.workspace.define_package "\
71
- "instead (and beware that the return value changed from "\
72
- "Autobuild::Package to Autoproj::PackageDefinition)"
93
+ "instead (and beware that the return value changed from "\
94
+ "Autobuild::Package to Autoproj::PackageDefinition)"
73
95
  )
74
- workspace.define_package(package_type, spec, block, *current_file).
75
- autobuild
96
+ workspace.define_package(package_type, spec, block, *current_file)
97
+ .autobuild
76
98
  end
77
99
 
78
100
  def self.loaded_autobuild_files
@@ -112,30 +134,35 @@ module Autoproj
112
134
 
113
135
  # Tries to find a handler automatically for 'full_path'
114
136
  def self.package_handler_for(full_path)
137
+ each_custom_package_handler do |handler|
138
+ pair = handler.call(full_path)
139
+ return pair if pair
140
+ end
115
141
  pyglob = File.join(File.basename(full_path), "*.py")
116
142
  if !Dir.enum_for(:glob, File.join(full_path, "*.orogen")).to_a.empty?
117
143
  ["orogen_package", full_path]
118
144
  elsif File.file?(File.join(full_path, "Makefile.am"))
119
145
  toplevel_dir = find_topmost_directory_containing(full_path) do |dir|
120
- configure_ac = File.join(dir, 'configure.ac')
121
- configure_in = File.join(dir, 'configure.in')
146
+ configure_ac = File.join(dir, "configure.ac")
147
+ configure_in = File.join(dir, "configure.in")
122
148
  File.file?(configure_ac) || File.file?(configure_in)
123
149
  end
124
- ['autotools_package', toplevel_dir] if toplevel_dir
150
+ ["autotools_package", toplevel_dir] if toplevel_dir
125
151
  elsif File.file?(File.join(full_path, "configure.ac")) ||
126
152
  File.file?(File.join(full_path, "configure.in"))
127
- ['autotools_package', full_path]
153
+ ["autotools_package", full_path]
128
154
  elsif File.file?(File.join(full_path, "CMakeLists.txt"))
129
155
  toplevel_dir = find_topmost_directory_containing(full_path) do |dir|
130
- cmakelists = File.join(dir, 'CMakeLists.txt')
156
+ cmakelists = File.join(dir, "CMakeLists.txt")
131
157
  File.file?(cmakelists) &&
132
158
  (File.read(cmakelists) =~ /PROJECT/i)
133
159
  end
134
160
  toplevel_dir ||= find_topmost_directory_containing(
135
- full_path, 'CMakeLists.txt')
161
+ full_path, "CMakeLists.txt"
162
+ )
136
163
 
137
- manifest_xml = File.join(toplevel_dir, 'manifest.xml')
138
- package_xml = File.join(toplevel_dir, 'package.xml')
164
+ manifest_xml = File.join(toplevel_dir, "manifest.xml")
165
+ package_xml = File.join(toplevel_dir, "package.xml")
139
166
  if File.file?(package_xml) && !File.file?(manifest_xml)
140
167
  return "catkin_package", toplevel_dir
141
168
  end
@@ -145,9 +172,9 @@ module Autoproj
145
172
  find_topmost_directory_containing(full_path, "lib/*.rb")))
146
173
 
147
174
  ["ruby_package", dir]
148
- elsif (dir = (find_topmost_directory_containing(full_path, 'setup.py') ||
175
+ elsif (dir = (find_topmost_directory_containing(full_path, "setup.py") ||
149
176
  find_topmost_directory_containing(full_path, pyglob)))
150
- ['python_package', dir]
177
+ ["python_package", dir]
151
178
  end
152
179
  end
153
180
  end
@@ -161,7 +188,7 @@ end
161
188
  # Adds a new setup block to an existing package
162
189
  def setup_package(package_name, workspace: Autoproj.workspace, &block)
163
190
  unless block
164
- raise Autoproj::ConfigError.new, 'you must give a block to #setup_package'
191
+ raise Autoproj::ConfigError.new, "you must give a block to #setup_package"
165
192
  end
166
193
 
167
194
  package_definition = workspace.manifest.find_package_definition(package_name)
@@ -182,7 +209,7 @@ def package_common(package_type, spec, workspace: Autoproj.workspace, &block)
182
209
  current_file = workspace.current_file[1]
183
210
  old_file = existing_package.file
184
211
  Autoproj.warn "#{package_name} from #{current_file} is overridden "\
185
- "by the definition in #{old_file}"
212
+ "by the definition in #{old_file}"
186
213
  return existing_package.autobuild
187
214
  end
188
215
 
@@ -197,9 +224,9 @@ end
197
224
 
198
225
  def python_package(name, workspace: Autoproj.workspace)
199
226
  package_common(:python, name, workspace: workspace) do |pkg|
200
- pkg.internal_dependency 'python'
227
+ pkg.internal_dependency "python"
201
228
  pkg.post_import do
202
- pkg.depends_on 'python-setuptools' if pkg.install_mode?
229
+ pkg.depends_on "python-setuptools" if pkg.install_mode?
203
230
  end
204
231
  yield(pkg) if block_given?
205
232
  end
@@ -207,9 +234,9 @@ end
207
234
 
208
235
  def common_make_default_test_task(pkg)
209
236
  unless pkg.test_utility.source_dir
210
- test_dir = File.join(pkg.srcdir, 'test')
237
+ test_dir = File.join(pkg.srcdir, "test")
211
238
  if File.directory?(test_dir)
212
- pkg.test_utility.source_dir = File.join(pkg.builddir, 'test', 'results')
239
+ pkg.test_utility.source_dir = File.join(pkg.builddir, "test", "results")
213
240
  end
214
241
  end
215
242
 
@@ -219,7 +246,7 @@ end
219
246
  def common_make_based_package_setup(pkg)
220
247
  unless pkg.has_doc? && pkg.doc_dir
221
248
  pkg.with_doc do
222
- doc_html = File.join(pkg.builddir, 'doc', 'html')
249
+ doc_html = File.join(pkg.builddir, "doc", "html")
223
250
  pkg.doc_dir = doc_html if File.directory?(doc_html)
224
251
  end
225
252
  end
@@ -245,7 +272,7 @@ end
245
272
  # information.
246
273
  def cmake_package(name, workspace: Autoproj.workspace)
247
274
  package_common(:cmake, name, workspace: workspace) do |pkg|
248
- pkg.depends_on 'cmake'
275
+ pkg.depends_on "cmake"
249
276
  common_make_based_package_setup(pkg)
250
277
  yield(pkg) if block_given?
251
278
  end
@@ -270,7 +297,7 @@ end
270
297
  # information.
271
298
  def autotools_package(name, workspace: Autoproj.workspace)
272
299
  package_common(:autotools, name, workspace: workspace) do |pkg|
273
- pkg.depends_on 'autotools'
300
+ pkg.depends_on "autotools"
274
301
  common_make_based_package_setup(pkg)
275
302
  yield(pkg) if block_given?
276
303
  end
@@ -290,9 +317,9 @@ end
290
317
 
291
318
  def ruby_package_default_test_task(pkg)
292
319
  unless pkg.test_utility.source_dir
293
- test_dir = File.join(pkg.srcdir, 'test')
320
+ test_dir = File.join(pkg.srcdir, "test")
294
321
  if File.directory?(test_dir)
295
- pkg.test_utility.source_dir = File.join(pkg.srcdir, '.test-results')
322
+ pkg.test_utility.source_dir = File.join(pkg.srcdir, ".test-results")
296
323
  FileUtils.mkdir_p pkg.test_utility.source_dir
297
324
  end
298
325
  end
@@ -358,7 +385,8 @@ def only_on(*architectures)
358
385
  architectures = architectures.map do |name|
359
386
  if name.respond_to?(:to_str)
360
387
  [name]
361
- else name
388
+ else
389
+ name
362
390
  end
363
391
  end
364
392
 
@@ -383,7 +411,8 @@ def not_on(*architectures)
383
411
  architectures = architectures.map do |name|
384
412
  if name.respond_to?(:to_str)
385
413
  [name]
386
- else name
414
+ else
415
+ name
387
416
  end
388
417
  end
389
418
 
@@ -407,7 +436,8 @@ def not_on(*architectures)
407
436
 
408
437
  new_packages.each do |pkg_name|
409
438
  manifest.exclude_package(
410
- pkg_name, "#{pkg_name} is disabled on this operating system")
439
+ pkg_name, "#{pkg_name} is disabled on this operating system"
440
+ )
411
441
  end
412
442
  end
413
443
 
@@ -497,8 +527,8 @@ def remove_from_default(*names)
497
527
  end
498
528
 
499
529
  def renamed_package(current_name, old_name, options)
500
- explicit_selection = Autoproj.workspace.manifest.
501
- explicitely_selected_in_layout?(old_name)
530
+ explicit_selection = Autoproj.workspace.manifest
531
+ .explicitely_selected_in_layout?(old_name)
502
532
  if options[:obsolete] && !explicit_selection
503
533
  import_package old_name
504
534
  Autoproj.workspace.manifest.exclude_package(
@@ -10,7 +10,8 @@ module Autoproj
10
10
  def pick_from_autoproj_root(package, installation_manifest)
11
11
  other_pkg = installation_manifest[package.name]
12
12
  return if !other_pkg || !File.directory?(other_pkg.srcdir)
13
- self.relocate(other_pkg.srcdir)
13
+
14
+ relocate(other_pkg.srcdir)
14
15
  true
15
16
  end
16
17
 
@@ -35,7 +36,7 @@ module Autoproj
35
36
 
36
37
  def normalize_branch_name(name)
37
38
  if name =~ /^refs\/heads\//
38
- return name
39
+ name
39
40
  else
40
41
  "refs/heads/#{name}"
41
42
  end
@@ -47,45 +48,45 @@ module Autoproj
47
48
  # It tests only against the parameters returned by {#snapshot}
48
49
  def snapshot_overrides?(snapshot)
49
50
  # We have to normalize the branch and tag names
50
- if snapshot_local = (snapshot['local_branch'] || snapshot['branch'])
51
+ if (snapshot_local = snapshot["local_branch"] || snapshot["branch"])
51
52
  snapshot_local = normalize_branch_name(snapshot_local)
52
- local_branch = normalize_branch_name(self.local_branch)
53
+ local_branch = normalize_branch_name(self.local_branch)
53
54
  return true if snapshot_local != local_branch
54
55
  end
55
- if snapshot_remote = (snapshot['remote_branch'] || snapshot['branch'])
56
+ if (snapshot_remote = snapshot["remote_branch"] || snapshot["branch"])
56
57
  snapshot_remote = normalize_branch_name(snapshot_remote)
57
58
  remote_branch = normalize_branch_name(self.remote_branch)
58
59
  return true if snapshot_remote != remote_branch
59
60
  end
60
- if snapshot_id = snapshot['commit']
61
- return true if self.commit != snapshot_id
61
+ if (snapshot_id = snapshot["commit"])
62
+ return true if commit != snapshot_id
62
63
  end
63
64
  false
64
65
  end
65
66
 
66
67
  # @api private
67
68
  def snapshot_against_remote(package, options = Hash.new)
68
- info = Hash['tag' => nil, 'commit' => nil]
69
- remote_revname = describe_commit_on_remote(package, 'HEAD', tags: options[:exact_state])
69
+ info = Hash["tag" => nil, "commit" => nil]
70
+ remote_revname = describe_commit_on_remote(package, "HEAD", tags: options[:exact_state])
70
71
 
71
72
  case remote_revname
72
73
  when /^refs\/heads\/(.*)/
73
74
  remote_branch = $1
74
75
  if local_branch == remote_branch
75
- info['branch'] = local_branch
76
+ info["branch"] = local_branch
76
77
  else
77
- info['local_branch'] = local_branch
78
- info['remote_branch'] = remote_branch
78
+ info["local_branch"] = local_branch
79
+ info["remote_branch"] = remote_branch
79
80
  end
80
81
  when /^refs\/tags\/(.*)/
81
- info['tag'] = $1
82
+ info["tag"] = $1
82
83
  else
83
- info['local_branch'] = local_branch
84
- info['remote_branch'] = remote_revname
84
+ info["local_branch"] = local_branch
85
+ info["remote_branch"] = remote_revname
85
86
  end
86
87
 
87
- if options[:exact_state] && !info['tag']
88
- info['commit'] = rev_parse(package, 'HEAD')
88
+ if options[:exact_state] && !info["tag"]
89
+ info["commit"] = rev_parse(package, "HEAD")
89
90
  end
90
91
  info
91
92
  end
@@ -93,21 +94,21 @@ module Autoproj
93
94
  # @api private
94
95
  def snapshot_local(package, options = Hash.new)
95
96
  info = Hash.new
96
- if local_branch != remote_branch
97
- info['local_branch'] = local_branch
98
- info['remote_branch'] = remote_branch
97
+ if local_branch == remote_branch
98
+ info["branch"] = branch
99
99
  else
100
- info['branch'] = branch
100
+ info["local_branch"] = local_branch
101
+ info["remote_branch"] = remote_branch
101
102
  end
102
103
 
103
104
  if options[:exact_state]
104
- has_tag, described = describe_rev(package, 'HEAD')
105
+ has_tag, described = describe_rev(package, "HEAD")
105
106
  if has_tag
106
- info['tag'] = described
107
- info['commit'] = nil
107
+ info["tag"] = described
108
+ info["commit"] = nil
108
109
  else
109
- info['tag'] = nil
110
- info['commit'] = described
110
+ info["tag"] = nil
111
+ info["commit"] = described
111
112
  end
112
113
  end
113
114
  info
@@ -8,6 +8,7 @@ module Autoproj
8
8
  attr_reader :os_packages
9
9
 
10
10
  attr_writer :ws
11
+
11
12
  def ws
12
13
  @ws ||= Autoproj.workspace
13
14
  end
@@ -46,9 +47,7 @@ module Autoproj
46
47
  # #add_tag
47
48
  def tags
48
49
  result = @added_tags.dup
49
- if description
50
- result |= description.tags.to_set
51
- end
50
+ result |= description.tags.to_set if description
52
51
  result
53
52
  end
54
53
 
@@ -68,7 +67,7 @@ module Autoproj
68
67
  # package
69
68
  def remove_obsolete_installed_orogen_package(name)
70
69
  post_install do
71
- path = File.join(prefix, 'lib', 'pkgconfig')
70
+ path = File.join(prefix, "lib", "pkgconfig")
72
71
  Dir.glob(File.join(path, "#{name}-*.pc")) do |pcfile|
73
72
  Autoproj.message " removing obsolete file #{pcfile}", :bold
74
73
  FileUtils.rm_f pcfile
@@ -100,13 +99,11 @@ module Autoproj
100
99
  end
101
100
 
102
101
  def autoproj_name # :nodoc:
103
- srcdir.gsub(/^#{Regexp.quote(ws.root_dir)}\//, '')
102
+ srcdir.gsub(/^#{Regexp.quote(ws.root_dir)}\//, "")
104
103
  end
105
104
 
106
105
  def depends_on(name)
107
- if name.respond_to?(:name) # probably a Package object
108
- name = name.name
109
- end
106
+ name = name.name if name.respond_to?(:name) # probably a Package object
110
107
 
111
108
  pkg_autobuild, pkg_os = partition_package(name)
112
109
  pkg_autobuild.each do |pkg|
@@ -120,10 +117,13 @@ module Autoproj
120
117
  all_dependencies(set)
121
118
  set.dup.each do |dep_pkg_name|
122
119
  next if original_set.include?(dep_pkg_name)
123
- if dep_pkg = ws.manifest.find_autobuild_package(dep_pkg_name)
120
+
121
+ if (dep_pkg = ws.manifest.find_autobuild_package(dep_pkg_name))
124
122
  set.merge(dep_pkg.os_packages)
125
123
  else
126
- raise ArgumentError, "#{dep_pkg_name}, which is listed as a dependency of #{name}, is not the name of a known package"
124
+ raise ArgumentError,
125
+ "#{dep_pkg_name}, which is listed as a dependency "\
126
+ "of #{name}, is not the name of a known package"
127
127
  end
128
128
  end
129
129
  set.merge(os_packages)
@@ -160,30 +160,31 @@ module Autoproj
160
160
  end
161
161
 
162
162
  def partition_package(pkg_name)
163
- pkg_autobuild, pkg_osdeps = [], []
163
+ pkg_autobuild = []
164
+ pkg_osdeps = []
164
165
  ws.manifest.resolve_package_name(pkg_name, include_unavailable: true).each do |type, dep_name|
165
166
  if type == :osdeps
166
167
  pkg_osdeps << dep_name
167
168
  elsif type == :package
168
169
  pkg_autobuild << dep_name
169
- else raise Autoproj::InternalError, "expected package type to be either :osdeps or :package, got #{type.inspect}"
170
+ else
171
+ raise Autoproj::InternalError, "expected package type to be either :osdeps or :package, got #{type.inspect}"
170
172
  end
171
173
  end
172
- return pkg_autobuild, pkg_osdeps
174
+ [pkg_autobuild, pkg_osdeps]
173
175
  end
174
176
 
175
177
  def partition_optional_dependencies
176
- packages, osdeps = [], []
178
+ packages = []
179
+ osdeps = []
177
180
  optional_dependencies.each do |name|
178
- begin
179
- pkg_autobuild, pkg_osdeps = partition_package(name)
180
- packages.concat(pkg_autobuild)
181
- osdeps.concat(pkg_osdeps)
182
- rescue Autoproj::PackageNotFound
183
- # Simply ignore non-existent optional dependencies
184
- end
181
+ pkg_autobuild, pkg_osdeps = partition_package(name)
182
+ packages.concat(pkg_autobuild)
183
+ osdeps.concat(pkg_osdeps)
184
+ rescue Autoproj::PackageNotFound
185
+ # Simply ignore non-existent optional dependencies
185
186
  end
186
- return packages, osdeps
187
+ [packages, osdeps]
187
188
  end
188
189
  end
189
190
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Autoproj
4
+ module AutobuildExtensions
5
+ # Extension for Autobuild::Python
6
+ module Python
7
+ def activate_python
8
+ Autoproj::Python.setup_python_configuration_options(ws: ws)
9
+ Autoproj::Python.assert_python_activated(ws: ws)
10
+ end
11
+
12
+ def update_environment
13
+ activate_python
14
+ super
15
+ end
16
+ end
17
+ end
18
+ end
@@ -3,9 +3,8 @@ module Autoproj
3
3
  module SVN
4
4
  def snapshot(package, target_dir = nil, options = Hash.new)
5
5
  version = svn_revision(package)
6
- Hash['revision' => version]
6
+ Hash["revision" => version]
7
7
  end
8
8
  end
9
9
  end
10
10
  end
11
-
data/lib/autoproj/base.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'yaml'
1
+ require "yaml"
2
2
  module Autoproj
3
3
  YAML_LOAD_ERROR =
4
4
  if defined? Psych::SyntaxError