2 new commits in pytest:

https://bitbucket.org/pytest-dev/pytest/commits/c0db30ab8e17/
Changeset:   c0db30ab8e17
Branch:      cx_freeze_ubuntu
User:        nicoddemus
Date:        2015-04-22 22:46:06+00:00
Summary:     Fix py27-cxfreeze tox environment

Use a custom script to install a patched version of cx_freeze,
as required in Ubuntu 14.04 systems
Affected #:  3 files

diff -r b89271e4512145c7a723a49ac760ee39240531f5 -r 
c0db30ab8e17bee0e977cea1fe55f75a632aeaeb .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -25,6 +25,8 @@
 doc/*/_build
 build/
 dist/
+testing/cx_freeze/build
+testing/cx_freeze/cx_freeze_source
 *.egg-info
 issue/
 env/

diff -r b89271e4512145c7a723a49ac760ee39240531f5 -r 
c0db30ab8e17bee0e977cea1fe55f75a632aeaeb testing/cx_freeze/install_cx_freeze.py
--- /dev/null
+++ b/testing/cx_freeze/install_cx_freeze.py
@@ -0,0 +1,66 @@
+"""
+Installs cx_freeze from source, but first patching
+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
+import platform
+
+if __name__ == '__main__':
+    if 'ubuntu' not in platform.version().lower():
+
+        print('Not Ubuntu, installing using pip. (platform.version() is %r)' %
+              platform.version())
+        res = os.system('pip install cx_freeze')
+        if res != 0:
+            sys.exit(res)
+        sys.exit(0)
+
+    if os.path.isdir('cx_freeze_source'):
+        shutil.rmtree('cx_freeze_source')
+    os.mkdir('cx_freeze_source')
+
+    res = os.system('pip install --download cx_freeze_source --no-use-wheel '
+                    'cx_freeze')
+    if res != 0:
+        sys.exit(res)
+
+    packages = glob.glob('cx_freeze_source/*.tar.gz')
+    assert len(packages) == 1
+    tar_filename = packages[0]
+
+    tar_file = tarfile.open(tar_filename)
+    try:
+        tar_file.extractall(path='cx_freeze_source')
+    finally:
+        tar_file.close()
+
+    basename = os.path.basename(tar_filename).replace('.tar.gz', '')
+    setup_py_filename = 'cx_freeze_source/%s/setup.py' % basename
+    with open(setup_py_filename) as f:
+        lines = f.readlines()
+
+    line_to_patch = 'if not vars.get("Py_ENABLE_SHARED", 0):'
+    for index, line in enumerate(lines):
+        if line_to_patch in line:
+            indent = line[:line.index(line_to_patch)]
+            lines[index] = indent + 'if True:\n'
+            print('Patched line %d' % (index + 1))
+            break
+    else:
+        sys.exit('Could not find line in setup.py to patch!')
+
+    with open(setup_py_filename, 'w') as f:
+        f.writelines(lines)
+
+    os.chdir('cx_freeze_source/%s' % basename)
+    res = os.system('python setup.py install')
+    if res != 0:
+        sys.exit(res)
+
+    sys.exit(0)
\ No newline at end of file

diff -r b89271e4512145c7a723a49ac760ee39240531f5 -r 
c0db30ab8e17bee0e977cea1fe55f75a632aeaeb tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -125,10 +125,10 @@
         -rfsxX --junitxml={envlogdir}/junit-{envname}2.xml []
 
 [testenv:py27-cxfreeze]
-deps=cx_freeze
 changedir=testing/cx_freeze
 basepython=python2.7
 commands=
+    {envpython} install_cx_freeze.py
     {envpython} runtests_setup.py build --build-exe build
     {envpython} tox_run.py
 


https://bitbucket.org/pytest-dev/pytest/commits/41aae470f1ad/
Changeset:   41aae470f1ad
Branch:      pytest-2.7
User:        hpk42
Date:        2015-04-23 10:03:14+00:00
Summary:     Merged in nicoddemus/pytest/cx_freeze_ubuntu (pull request #280)

Fix py27-cxfreeze tox environment
Affected #:  3 files

diff -r 6f7fb5f6a3822d0736eb3c0ac405441c17705940 -r 
41aae470f1ad196d7ed3fa53e9a7074b44b316c3 .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -25,6 +25,8 @@
 doc/*/_build
 build/
 dist/
+testing/cx_freeze/build
+testing/cx_freeze/cx_freeze_source
 *.egg-info
 issue/
 env/

diff -r 6f7fb5f6a3822d0736eb3c0ac405441c17705940 -r 
41aae470f1ad196d7ed3fa53e9a7074b44b316c3 testing/cx_freeze/install_cx_freeze.py
--- /dev/null
+++ b/testing/cx_freeze/install_cx_freeze.py
@@ -0,0 +1,66 @@
+"""
+Installs cx_freeze from source, but first patching
+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
+import platform
+
+if __name__ == '__main__':
+    if 'ubuntu' not in platform.version().lower():
+
+        print('Not Ubuntu, installing using pip. (platform.version() is %r)' %
+              platform.version())
+        res = os.system('pip install cx_freeze')
+        if res != 0:
+            sys.exit(res)
+        sys.exit(0)
+
+    if os.path.isdir('cx_freeze_source'):
+        shutil.rmtree('cx_freeze_source')
+    os.mkdir('cx_freeze_source')
+
+    res = os.system('pip install --download cx_freeze_source --no-use-wheel '
+                    'cx_freeze')
+    if res != 0:
+        sys.exit(res)
+
+    packages = glob.glob('cx_freeze_source/*.tar.gz')
+    assert len(packages) == 1
+    tar_filename = packages[0]
+
+    tar_file = tarfile.open(tar_filename)
+    try:
+        tar_file.extractall(path='cx_freeze_source')
+    finally:
+        tar_file.close()
+
+    basename = os.path.basename(tar_filename).replace('.tar.gz', '')
+    setup_py_filename = 'cx_freeze_source/%s/setup.py' % basename
+    with open(setup_py_filename) as f:
+        lines = f.readlines()
+
+    line_to_patch = 'if not vars.get("Py_ENABLE_SHARED", 0):'
+    for index, line in enumerate(lines):
+        if line_to_patch in line:
+            indent = line[:line.index(line_to_patch)]
+            lines[index] = indent + 'if True:\n'
+            print('Patched line %d' % (index + 1))
+            break
+    else:
+        sys.exit('Could not find line in setup.py to patch!')
+
+    with open(setup_py_filename, 'w') as f:
+        f.writelines(lines)
+
+    os.chdir('cx_freeze_source/%s' % basename)
+    res = os.system('python setup.py install')
+    if res != 0:
+        sys.exit(res)
+
+    sys.exit(0)
\ No newline at end of file

diff -r 6f7fb5f6a3822d0736eb3c0ac405441c17705940 -r 
41aae470f1ad196d7ed3fa53e9a7074b44b316c3 tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -125,10 +125,10 @@
         -rfsxX --junitxml={envlogdir}/junit-{envname}2.xml []
 
 [testenv:py27-cxfreeze]
-deps=cx_freeze
 changedir=testing/cx_freeze
 basepython=python2.7
 commands=
+    {envpython} install_cx_freeze.py
     {envpython} runtests_setup.py build --build-exe build
     {envpython} tox_run.py

Repository URL: https://bitbucket.org/pytest-dev/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to