Skip to content

Commit

Permalink
Filename 35 Issue Resolution
Browse files Browse the repository at this point in the history
Fix 35 Path issue
  • Loading branch information
morganjwilliams committed Aug 8, 2018
1 parent 82a507c commit 4f02024
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions pyrolite/util/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def copy_file(src, dst, ext=None):
src = src.with_suffix(ext)
dst = dst.with_suffix(ext)
print('Copying from {} to {}'.format(src, dst))
with open(src, 'rb') as fin:
with open(dst, 'wb') as fout:
with open(str(src), 'rb') as fin:
with open(str(dst), 'wb') as fout:
shutil.copyfileobj(fin, fout)


Expand All @@ -116,5 +116,5 @@ def extract_zip(zipfile, output_dir):
fldr, name = re.split('/', m, maxsplit=1)
if name:
content = zipfile.open(m, 'r').read()
with open(output_dir / name, 'wb') as out:
with open(str(output_dir / name), 'wb') as out:
out.write(content)
4 changes: 2 additions & 2 deletions pyrolite/util/melts.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def install_melts(install_dir,
Melts gets confused with the directory structure...
and creates .bat files which point to the wrong place
"""
install_source = os.path.join(temp_dir, 'install.command')
install_source = os.path.join(str(temp_dir), 'install.command')
args = ["perl", install_source]

# [C:\Users\<>\Documents\bin]
Expand Down Expand Up @@ -296,7 +296,7 @@ def install_melts(install_dir,
batdata['alphamelts'] = '''@echo off\n"{}"'''.format(
install_dir / alphafile.name)
for b in bats:
with open(b, 'w') as fout:
with open(str(b), 'w') as fout:
fout.write(batdata[b.stem]) # dummy bats

files_to_copy += [(link_dir, bats)]
Expand Down
10 changes: 5 additions & 5 deletions test/util/test_util_melts.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class TestDownload(unittest.TestCase):
def setUp(self):
userdir = Path("~").expanduser()
root = Path(userdir.drive) / userdir.root
if root/'tmp' in root.iterdir():
if root/'tmp' in root.iterdir(): #.nix
self.temp_dir = root / 'tmp' / 'test_melts_temp'
else:
self.temp_dir = root / 'test_melts_temp'
self.temp_dir = root / 'temp' / 'test_melts_temp'

def check_download(self):
"""Tries to download MELTS files to a specific directory."""
Expand All @@ -58,12 +58,12 @@ class TestInstall(unittest.TestCase):
def setUp(self):
userdir = Path("~").expanduser()
root = Path(userdir.drive) / userdir.root
if root/'tmp' in root.iterdir():
if root/'tmp' in root.iterdir(): #.nix
self.temp_dir = root / 'tmp' / 'test_melts_temp'
self.dir = root / 'tmp' / 'test_melts_install'
else:
self.temp_dir = root / 'test_melts_temp'
self.dir = root / 'test_melts_install'
self.temp_dir = root / 'temp' / 'test_melts_temp'
self.dir = root / 'temp' /'test_melts_install'

@unittest.skipIf(not check_perl(), "Perl is not installed.")
def test_perl_install(self):
Expand Down

0 comments on commit 4f02024

Please sign in to comment.