From dd527bfcdc9c36215f406a347cb179dc90fd7fe2 Mon Sep 17 00:00:00 2001
From: Zhiming Wang <zmwangx@gmail.com>
Date: Tue, 25 Oct 2016 01:44:40 -0400
Subject: [PATCH] bottle: fix nonexistent pyc bug

We were deleting pyc files *after* replace_locations_with_placeholders
and recording changed_files, meaning that some of the recorded files
were to be deleted. The correct order is the opposite.

A sample failed session: https://bot.brew.sh/job/Homebrew%20Core/10080/version=el_capitan/testReport/junit/brew-test-bot/el_capitan/bottle_buku/.
---
 Library/Homebrew/dev-cmd/bottle.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb
index dcc9e0e98c..b1a3ebb431 100644
--- a/Library/Homebrew/dev-cmd/bottle.rb
+++ b/Library/Homebrew/dev-cmd/bottle.rb
@@ -190,12 +190,12 @@ module Homebrew
       changed_files = nil
 
       begin
+        keg.delete_pyc_files!
+
         unless ARGV.include? "--skip-relocation"
           changed_files = keg.replace_locations_with_placeholders
         end
 
-        keg.delete_pyc_files!
-
         Tab.clear_cache
         tab = Tab.for_keg(keg)
         original_tab = tab.dup
-- 
GitLab