From 6bca5a1c25163931cd7e73d145f262fbeaf9f665 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 17 Sep 2015 11:54:44 -0300 Subject: [PATCH 1/5] Use temporary directory for cx_freeze testing --- testing/cx_freeze/install_cx_freeze.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/testing/cx_freeze/install_cx_freeze.py b/testing/cx_freeze/install_cx_freeze.py index 801c3b2c8..f7d9d091b 100644 --- a/testing/cx_freeze/install_cx_freeze.py +++ b/testing/cx_freeze/install_cx_freeze.py @@ -10,6 +10,7 @@ import tarfile import os import sys import platform +import py if __name__ == '__main__': if 'ubuntu' not in platform.version().lower(): @@ -21,27 +22,25 @@ if __name__ == '__main__': sys.exit(res) sys.exit(0) - if os.path.isdir('cx_freeze_source'): - shutil.rmtree('cx_freeze_source') - os.mkdir('cx_freeze_source') + rootdir = py.path.make_numbered_dir(prefix='cx_freeze') - res = os.system('pip install --download cx_freeze_source --no-use-wheel ' - 'cx_freeze') + res = os.system('pip install --download %s --no-use-wheel ' + 'cx_freeze' % rootdir) if res != 0: sys.exit(res) - packages = glob.glob('cx_freeze_source/*.tar.gz') + packages = glob.glob('%s/*.tar.gz' % rootdir) assert len(packages) == 1 tar_filename = packages[0] tar_file = tarfile.open(tar_filename) try: - tar_file.extractall(path='cx_freeze_source') + tar_file.extractall(path=str(rootdir)) finally: tar_file.close() basename = os.path.basename(tar_filename).replace('.tar.gz', '') - setup_py_filename = 'cx_freeze_source/%s/setup.py' % basename + setup_py_filename = '%s/%s/setup.py' % (rootdir, basename) with open(setup_py_filename) as f: lines = f.readlines() @@ -58,9 +57,9 @@ if __name__ == '__main__': with open(setup_py_filename, 'w') as f: f.writelines(lines) - os.chdir('cx_freeze_source/%s' % basename) + os.chdir('%s/%s' % (basename, rootdir)) res = os.system('python setup.py install') if res != 0: sys.exit(res) - sys.exit(0) \ No newline at end of file + sys.exit(0) From f5f3a2a92809b7d9e2b128b4a716f88adf58d601 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 17 Sep 2015 12:54:02 -0300 Subject: [PATCH 2/5] Fix flaky failure about unused shutil --- testing/cx_freeze/install_cx_freeze.py | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/cx_freeze/install_cx_freeze.py b/testing/cx_freeze/install_cx_freeze.py index f7d9d091b..cc3e1868c 100644 --- a/testing/cx_freeze/install_cx_freeze.py +++ b/testing/cx_freeze/install_cx_freeze.py @@ -5,7 +5,6 @@ setup.py as described here: http://stackoverflow.com/questions/25107697/compiling-cx-freeze-under-ubuntu """ import glob -import shutil import tarfile import os import sys From 3a8e375efeac2c2f2a87d678606c76d1424650c6 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 17 Sep 2015 14:52:51 -0300 Subject: [PATCH 3/5] Fix import --- testing/cx_freeze/install_cx_freeze.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/cx_freeze/install_cx_freeze.py b/testing/cx_freeze/install_cx_freeze.py index cc3e1868c..e04976aa3 100644 --- a/testing/cx_freeze/install_cx_freeze.py +++ b/testing/cx_freeze/install_cx_freeze.py @@ -21,7 +21,7 @@ if __name__ == '__main__': sys.exit(res) sys.exit(0) - rootdir = py.path.make_numbered_dir(prefix='cx_freeze') + rootdir = py.path.local.make_numbered_dir(prefix='cx_freeze') res = os.system('pip install --download %s --no-use-wheel ' 'cx_freeze' % rootdir) From e4d5f8825733697a2ae816f8a0e8265ac4f188c3 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 17 Sep 2015 23:32:27 -0300 Subject: [PATCH 4/5] Fix install cx_freeze --- testing/cx_freeze/install_cx_freeze.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/cx_freeze/install_cx_freeze.py b/testing/cx_freeze/install_cx_freeze.py index e04976aa3..83dce87aa 100644 --- a/testing/cx_freeze/install_cx_freeze.py +++ b/testing/cx_freeze/install_cx_freeze.py @@ -56,7 +56,7 @@ if __name__ == '__main__': with open(setup_py_filename, 'w') as f: f.writelines(lines) - os.chdir('%s/%s' % (basename, rootdir)) + os.chdir('%s/%s' % (rootdir, basename)) res = os.system('python setup.py install') if res != 0: sys.exit(res) From 546093175eb8dffeb6d4a21ec23da94416ce6c22 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 17 Sep 2015 23:34:09 -0300 Subject: [PATCH 5/5] White list rm for cxfreeze env --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index be04e0a0a..69c9d0f52 100644 --- a/tox.ini +++ b/tox.ini @@ -107,6 +107,7 @@ commands= py.test -rfsxX {posargs} changedir=doc/en deps=sphinx PyYAML +whitelist_externals=rm commands= rm -rf /tmp/doc-exec* #pip install pytest==2.3.4