Code review comment for lp:~gary/launchpad/bug-491705-hack

Revision history for this message
Gary Poster (gary) wrote :

This branch uses a hacked version of zc.buildout to work around the problem described in https://bugs.edge.launchpad.net/launchpad-foundations/+bug/491705 . The diff for this branch is below. It essentially only adds the following line to the top of generated scripts, such as bin/run:

import encodings.utf_8 # Hack to fix sys.modules approach.

This is the change that LOSAs have made manually in past deployments. It is not the right fix, which I am working on in svn://svn.zope.org/repos/main/zc.buildout/branches/gary-4 , but it gives us more breathing room.

The branch with the changes below is svn://svn.zope.org/repos/main/zc.buildout/branches/gary-8-hack-fix .

Thank you

Gary

Modified: zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/easy_install.py 2010-01-20 21:08:52 UTC (rev 108340)
+++ zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/easy_install.py 2010-01-20 21:09:31 UTC (rev 108341)
@@ -1287,8 +1287,8 @@
else:
    script_header = '#!%(python)s'

-script_template = script_header + '''\
-
+script_template = script_header + '''
+import encodings.utf_8 # Hack to fix sys.modules approach.
%(relative_paths_setup)s
import site
import sys
@@ -1365,8 +1365,8 @@
    generated.append(dest)
    return generated

-py_script_template = script_header + '''\
-
+py_script_template = script_header + '''
+import encodings.utf_8 # Hack to fix sys.modules approach.
# Get a clean copy of globals before import or variable definition.
globs = globals().copy()

Modified: zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/easy_install.txt
===================================================================
--- zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/easy_install.txt 2010-01-20 21:08:52 UTC (rev 108340)
+++ zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/easy_install.txt 2010-01-20 21:09:31 UTC (rev 108341)
@@ -649,6 +649,7 @@

cat(bin, 'demo') # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys
@@ -721,6 +722,7 @@

cat(bin, 'demo') # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys
@@ -799,6 +801,7 @@

cat(bin, 'py') # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    # Get a clean copy of globals before import or variable definition.
    globs = globals().copy()
    <BLANKLINE>
@@ -969,6 +972,7 @@

cat(bin, 'run') # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys
@@ -1097,6 +1101,7 @@

cat(bin, 'run') # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys
@@ -1152,6 +1157,7 @@

cat(bin, 'run') # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys
@@ -1224,6 +1230,7 @@

cat(bo, 'bin', 'run') # doctest: +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import os
    <BLANKLINE>
@@ -1287,6 +1294,7 @@

cat(bo, 'bin', 'py') # doctest: +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    # Get a clean copy of globals before import or variable definition.
    globs = globals().copy()
    <BLANKLINE>

Modified: zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/update.txt
===================================================================
--- zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/update.txt 2010-01-20 21:08:52 UTC (rev 108340)
+++ zc.buildout/branches/gary-8-hack-fix/src/zc/buildout/update.txt 2010-01-20 21:09:31 UTC (rev 108341)
@@ -82,6 +82,7 @@

cat(sample_buildout, 'bin', 'buildout') # doctest: +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys

Modified: zc.buildout/branches/gary-8-hack-fix/zc.recipe.egg_/src/zc/recipe/egg/README.txt
===================================================================
--- zc.buildout/branches/gary-8-hack-fix/zc.recipe.egg_/src/zc/recipe/egg/README.txt 2010-01-20 21:08:52 UTC (rev 108340)
+++ zc.buildout/branches/gary-8-hack-fix/zc.recipe.egg_/src/zc/recipe/egg/README.txt 2010-01-20 21:09:31 UTC (rev 108341)
@@ -375,6 +375,7 @@
cat(sample_buildout, 'bin', 'foo')
    ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys
@@ -454,6 +455,7 @@
cat(sample_buildout, 'bin', 'foo')
    ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import os
    <BLANKLINE>
@@ -533,6 +535,7 @@
cat(sample_buildout, 'bin', 'foo')
    ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import os
    <BLANKLINE>
@@ -617,6 +620,7 @@
cat(sample_buildout, 'bin', 'foo')
    ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys
@@ -707,6 +711,7 @@
cat(sample_buildout, 'bin', 'other')
    ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
    #!/usr/local/bin/python2.4
+ import encodings.utf_8 # Hack to fix sys.modules approach.
    <BLANKLINE>
    import site
    import sys

« Back to merge proposal