Skip to content

Commit

Permalink
allow case insensitive matches of prefix path in binaries (based on e…
Browse files Browse the repository at this point in the history
…xperience)
  • Loading branch information
msarahan committed Aug 4, 2016
1 parent e5358e3 commit 88f63a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json
import logging
import os
import re
import shutil
import stat
import subprocess
Expand Down Expand Up @@ -107,6 +108,8 @@ def have_prefix_files(files):
forward_slash_prefix_bytes = forward_slash_prefix.encode('utf-8')
double_backslash_prefix = prefix.replace('\\', '\\\\')
double_backslash_prefix_bytes = double_backslash_prefix.encode('utf-8')
# moar escapes for regex
prefix_bytes = prefix_bytes.replace('\\', '\\\\')

for f in files:
if f.endswith(('.pyc', '.pyo', '.a')):
Expand Down Expand Up @@ -136,8 +139,9 @@ def have_prefix_files(files):
mm.close() and fi.close()
fi = open(path, 'rb+')
mm = mmap.mmap(fi.fileno(), 0)
if mm.find(prefix_bytes) != -1:
yield (prefix, mode, f)
prefix_matches = re.findall(prefix_bytes, mm, re.IGNORECASE)
for match in prefix_matches:
yield (match, mode, f)
if on_win and mm.find(forward_slash_prefix_bytes) != -1:
# some windows libraries use unix-style path separators
yield (forward_slash_prefix, mode, f)
Expand Down

0 comments on commit 88f63a7

Please sign in to comment.