autoproj 2.6.0 → 2.6.1

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
  SHA1:
3
- metadata.gz: f873ef54ef817b4d8c0a029092ed0be7d645ee12
4
- data.tar.gz: 38cfd4ae602a9c92b2a611eade91692060e6ef18
3
+ metadata.gz: 68e9f51443df2835dca1ca6018c66c1ddddc191c
4
+ data.tar.gz: 90ddec45d88fad399a89f27b5125e64ce776a692
5
5
  SHA512:
6
- metadata.gz: dce1888ec2edf6cd54a9c1e0fa158431be3b52d30c777a58781fb684cdb9f0580ddcf12488b323f425a5cfe3fd22f1a1661f30e5b402d060cd9703fbb8660d7f
7
- data.tar.gz: 0b1702cd8ba4c0950f6e4023df314a804c05f00ef0f10295981aac6d1c495bce3b00af1e90e137d75ec3766ed338107bcf9cb3faed9ff400dea248505c80a143
6
+ metadata.gz: 8262c141ccda64777df11c91a3536bfe23feb48f9189fd16d04b7a891a1227ceb7c6a54bb5e5067ae7efce930a6cd965b47fcf38f951eb23c4ddc9c81bda0c20
7
+ data.tar.gz: 5ee4a343b0fafda6f82be49c87a87d60e8242521b0a532d726bf896f4b384bee2c8b6e5b9abb1ba2a5062981ba0883de04397431d3edd6da31ee918598c72399
@@ -139,14 +139,36 @@ def each_author
139
139
 
140
140
  # @api private
141
141
  #
142
- # REXML stream parser object used to load the XML contents into a
143
- # {PackageManifest} object
144
- class Loader
142
+ # REXML stream parser object used to filter nested tags
143
+ class BaseLoader
145
144
  include REXML::StreamListener
146
145
 
146
+ def initialize
147
+ @tag_level = 0
148
+ end
149
+
150
+ def tag_start(name, attributes)
151
+ toplevel_tag_start(name, attributes) if (@tag_level += 1) == 2
152
+ end
153
+
154
+ def tag_end(name)
155
+ toplevel_tag_end(name) if (@tag_level -= 1) == 1
156
+ end
157
+
158
+ def text(text)
159
+ @tag_text << text if @tag_text
160
+ end
161
+ end
162
+
163
+ # @api private
164
+ #
165
+ # REXML stream parser object used to load the XML contents into a
166
+ # {PackageManifest} object
167
+ class Loader < BaseLoader
147
168
  attr_reader :path, :manifest
148
169
 
149
170
  def initialize(path, manifest)
171
+ super()
150
172
  @path = path
151
173
  @manifest = manifest
152
174
  end
@@ -178,7 +200,7 @@ def parse_contact_field(text)
178
200
  TEXT_FIELDS = Set['url', 'license', 'version', 'description']
179
201
  AUTHOR_FIELDS = Set['author', 'maintainer', 'rock_maintainer']
180
202
 
181
- def tag_start(name, attributes)
203
+ def toplevel_tag_start(name, attributes)
182
204
  if name == 'depend'
183
205
  parse_depend_tag(name, attributes)
184
206
  elsif name == 'depend_optional'
@@ -200,12 +222,7 @@ def tag_start(name, attributes)
200
222
  @tag_text = nil
201
223
  end
202
224
  end
203
- def text(text)
204
- if @tag_text
205
- @tag_text << text
206
- end
207
- end
208
- def tag_end(name)
225
+ def toplevel_tag_end(name)
209
226
  if AUTHOR_FIELDS.include?(name)
210
227
  manifest.send("#{name}s").concat(parse_contact_field(@tag_text))
211
228
  elsif TEXT_FIELDS.include?(name)
@@ -225,11 +242,12 @@ def tag_end(name)
225
242
  # REXML stream parser object used to load the XML contents into a
226
243
  # {PackageManifest} object
227
244
  class RosLoader < Loader
245
+ SUPPORTED_MODES = ['test'].freeze
228
246
  DEPEND_TAGS = Set['depend', 'build_depend', 'build_export_depend',
229
247
  'buildtool_depend', 'buildtool_export_depend',
230
248
  'exec_depend', 'test_depend', 'run_depend']
231
249
 
232
- def tag_start(name, attributes)
250
+ def toplevel_tag_start(name, attributes)
233
251
  if DEPEND_TAGS.include?(name)
234
252
  @tag_text = ''
235
253
  elsif TEXT_FIELDS.include?(name)
@@ -242,10 +260,16 @@ def tag_start(name, attributes)
242
260
  end
243
261
  end
244
262
 
245
- def tag_end(name)
263
+ def toplevel_tag_end(name)
246
264
  if DEPEND_TAGS.include?(name)
247
265
  raise InvalidPackageManifest, "found '#{name}' tag in #{path} without content" if @tag_text.strip.empty?
248
- manifest.add_dependency(@tag_text)
266
+
267
+ mode = []
268
+ if name =~ /^(\w+)_depend$/
269
+ mode = SUPPORTED_MODES & [$1]
270
+ end
271
+
272
+ manifest.add_dependency(@tag_text, modes: mode)
249
273
  elsif AUTHOR_FIELDS.include?(name)
250
274
  author_name = @tag_text.strip
251
275
  email = @author_email ? @author_email.strip : nil
@@ -49,8 +49,28 @@ def error(error)
49
49
  Autoproj.message line, STDERR
50
50
  end
51
51
  end
52
+
53
+ def reset_timer
54
+ @timer_start = Time.now
55
+ end
56
+
57
+ def elapsed_time
58
+ return unless @timer_start
59
+ secs = Time.now - @timer_start
60
+ return if secs < 1
61
+
62
+ [[60, 'sec'], [60, 'min'], [24, 'hour'], [1000, 'day']].map do |count, name|
63
+ if secs > 0
64
+ secs, n = secs.divmod(count)
65
+ next if (val = n.to_i) == 0
66
+ "#{val} #{val > 1 ? name + 's' : name}"
67
+ end
68
+ end.compact.reverse.join(' ')
69
+ end
70
+
52
71
  def success
53
- Autoproj.message("Command finished successfully at #{Time.now}", :bold, :green)
72
+ elapsed_string = elapsed_time ? " (took #{elapsed_time})" : ''
73
+ Autoproj.message("Command finished successfully at #{Time.now}#{elapsed_string}", :bold, :green)
54
74
  if Autobuild.post_success_message
55
75
  Autoproj.message Autobuild.post_success_message
56
76
  end
@@ -65,6 +85,7 @@ def self.report(root_dir: nil, silent: nil, debug: Autobuild.debug,
65
85
  interrupted = nil
66
86
  package_failures = Autobuild::Reporting.report(on_package_failures: :report_silent) do
67
87
  begin
88
+ reporter.reset_timer
68
89
  yield
69
90
  rescue Interrupt => e
70
91
  interrupted = e
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "2.6.0"
2
+ VERSION = "2.6.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler