Skip to content

bootstrap_eb.py, version 20200203.01, error installing distribute_setup.py #3200

@justbennet

Description

@justbennet

Trying the new bootstrap_eb.py, and I get this

[[INFO]] EasyBuild bootstrap script (version 20200203.01, MD5: a2d71121de3c3f328f4d59f9eaf27f34)
[[INFO]] Found Python 3.6.6 (default, Mar 29 2019, 00:03:27) ; [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
[[INFO]] Installation prefix /sw/arcts/centos7/easybuild
[[INFO]] Found module command '/sw/arcts/centos7/lmod/lmod/libexec/lmod' via $LMOD_CMD (Lmod), so using it.
[[INFO]] No suitable setuptools installation found, proceeding with stage 0...
[[INFO]] +++ STAGE 0: installing distribute via included (patched) distribute_setup.py...
Traceback (most recent call last):
  File "bootstrap_eb.py", line 1157, in <module>
    main()
  File "bootstrap_eb.py", line 942, in main
    distribute_egg_dir = stage0(tmpdir)
  File "bootstrap_eb.py", line 431, in stage0
    txt)
  File "/usr/lib64/python3.6/re.py", line 191, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: cannot use a string pattern on a bytes-like object

just downloaded from
https://raw.githubusercontent.com/easybuilders/easybuild-framework/develop/easybuild/scripts/bootstrap_eb.py

The code that it refers to, File "bootstrap_eb.py", line 431, in stage0, is

        txt = re.sub(r'([^\n]*)(return subprocess.call\(args)(\) == 0)',
                     r"\1f = open(os.devnull, 'w'); \2, stdout=f, stderr=f\3",
                     txt)

where

txt = DISTRIBUTE_SETUP_PY
and
if IS_PY3:
    DISTRIBUTE_SETUP_PY = DISTRIBUTE_SETUP_PY.encode('ascii')
DISTRIBUTE_SETUP_PY = codecs.decode(codecs.decode(DISTRIBUTE_SETUP_PY, "base64"), "zlib")

It looks like the decoding of DISTRIBUTE_SETUP_PY may now result in a byte-stream instead of a string, so the regular expression is carping.

[bennet@lh-build tmp]$ python bootstrap_eb.py /tmp/hinky
DISTRIBUTE_SETUP_PY is
<type 'str'>

[bennet@lh-build tmp]$ python3 bootstrap_eb.py /tmp/hinky
DISTRIBUTE_SETUP_PY is
<class 'bytes'>

Converting it to a string with DISTRIBUTE_SETUP_PY = str(DISTRIBUTE_SETUP_PY) results in

[[INFO]] +++ STAGE 0: installing distribute via included (patched) distribute_setup.py...

Traceback (most recent call last):
  File "bootstrap_eb.py", line 1161, in <module>
    main()
  File "bootstrap_eb.py", line 942, in main
    distribute_egg_dir = stage0(tmpdir)
  File "bootstrap_eb.py", line 445, in stage0
    import distribute_setup
  File "/tmp/tmpu3v2qci7/distribute_setup.py", line 1
    b'#!python\n"""Bootstrap distribute installation\n\nIf you want to use setuptools in your package\'s setup.py, just include this\nfile in the same directory with it, and add this to the top of your setup.py::\n\n . . . .
[rest of the contents]

SyntaxError: invalid syntax

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions