Skip to content

Commit 78d08ef

Browse files
authored
Merge pull request #2123 from jordansissel/issue/2120
Fix multiple backwards compatibility issues found in fpm v1.17.0
2 parents d4b986c + 6db9a02 commit 78d08ef

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/fpm/package/python.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def self.parse(input)
119119
headers[field] = []
120120
end
121121

122-
while !s.eos? and !s.scan("\n") do
122+
while !s.eos? and !s.scan(/\n/) do
123123
# Field is non-space up, but excluding the colon
124124
field = s.scan(/[^\s:]+/)
125125

@@ -148,11 +148,11 @@ def self.parse(input)
148148
# Per Python core-metadata spec:
149149
# > Changed in version 2.1: This field may be specified in the message body instead.
150150
#return PythonMetadata.new(headers, s.string[s.pos ...])
151-
return headers, s.string[s.pos ... ]
151+
return headers, s.string[s.pos .. -1]
152152
elsif headers["Metadata-Version"].to_f >= 2.0
153153
# dnspython v1.15.0 has a description body and Metadata-Version 2.0
154154
# this seems out of spec, but let's accept it anyway.
155-
return headers, s.string[s.pos ... ]
155+
return headers, s.string[s.pos .. -1]
156156
else
157157
raise "After reading METADATA headers, extra data is in the file but was not expected. This may be a bug in fpm."
158158
end
@@ -166,7 +166,7 @@ def self.parse(input)
166166
puts "---"
167167
puts input
168168
puts "==="
169-
puts input[s.pointer...]
169+
puts input[s.pointer..-1]
170170
puts "---"
171171
raise e
172172
end # self.parse
@@ -453,7 +453,7 @@ def download_if_necessary(package, version=nil)
453453

454454
safesystem(*setup_cmd)
455455

456-
files = ::Dir.entries(target).filter { |entry| entry =~ /\.(whl|tgz|tar\.gz|zip)$/ }
456+
files = ::Dir.entries(target).select { |entry| entry =~ /\.(whl|tgz|tar\.gz|zip)$/ }
457457
if files.length != 1
458458
raise "Unexpected directory layout after `pip download ...`. This might be an fpm bug? The directory contains these files: #{files.inspect}"
459459
end

spec/fpm/util_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
ta = File.join(target, "a")
2626
tb = File.join(target, "b")
2727
subject.copy_entry(a, ta)
28-
subject.copy_entry(b, tb, true, true)
28+
subject.copy_entry(b, tb, false, true)
2929

3030
# This seems to work to compare file stat calls.
3131
# target 'a' and 'b' should have the same stat result because

0 commit comments

Comments
 (0)