Skip to content

Commit

Permalink
Merge pull request #1272 from msarahan/remove_pyc_from_test
Browse files Browse the repository at this point in the history
remove pyc files from test directory to avoid __file__ errors
  • Loading branch information
msarahan authored Aug 26, 2016
2 parents 10cfa4f + 8fb9b4d commit 3333d2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conda_build/create_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
from __future__ import absolute_import, division, print_function

import glob
import os
from os.path import join, exists, isdir
import sys

from conda_build.utils import copy_into
from conda_build.utils import copy_into, get_ext_files
from conda_build import source


Expand Down Expand Up @@ -58,6 +59,8 @@ def create_files(dir_path, m, config):
files = glob.glob(join(config.work_dir, pattern))
for f in files:
copy_into(f, f.replace(config.work_dir, config.test_dir), config.timeout)
for f in get_ext_files(config.test_dir, '.pyc'):
os.remove(f)
return has_files


Expand Down
8 changes: 8 additions & 0 deletions conda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,11 @@ def guess_license_family(license, allowed_license_families):
else:
return get_close_matches(license,
allowed_license_families, 1, 0.0)[0]


# Return all files in dir, and all its subdirectories, ending in pattern
def get_ext_files(start_path, pattern):
for _, subdirs, files in os.walk(start_path):
for f in files:
if f.endswith(pattern):
yield os.path.join(dirname, f)

0 comments on commit 3333d2e

Please sign in to comment.