asottile / dockerfile

Parse a dockerfile into a high-level representation using the official go parser
MIT License
97 stars 18 forks source link

Python wheels fail to build with go 1.16 #71

Closed nmalaguti closed 3 years ago

nmalaguti commented 3 years ago

When running tox with go 1.16, there's an error for a missing go.mod file. I tried generating it with

$ go mod init github.com/asottile/dockerfile
$ go mod tidy

but for some reason the go.mod file wasn't copied to the temp directory.

py36 inst-nodeps: /Users/nmalaguti/git/dockerfile/.tox/.tmp/package/1/dockerfile-3.1.0.zip
ERROR: invocation failed (exit code 1), logfile: /Users/nmalaguti/git/dockerfile/.tox/py36/log/py36-4.log
================================================================ log start =================================================================
Looking in indexes: https://pypip.knewton.net/simple/
Processing ./.tox/.tmp/package/1/dockerfile-3.1.0.zip
Building wheels for collected packages: dockerfile
  Building wheel for dockerfile (setup.py): started
  Building wheel for dockerfile (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /Users/nmalaguti/git/dockerfile/.tox/py36/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/setup.py'"'"'; __file__='"'"'/private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-wheel-xxissus_
       cwd: /private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/
  Complete output (44 lines):
  running bdist_wheel
  running build
  running build_ext
  $ GOPATH=/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/tmpp15mi08g go get -d
  go: go.mod file not found in current directory or any parent directory; see 'go help modules'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/setup.py", line 36, in <module>
      build_golang={'root': 'github.com/asottile/dockerfile'},
    File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 79, in run
      _build_ext.run(self)
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
      self._build_extensions_serial()
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
      self.build_extension(ext)
    File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools_golang.py", line 155, in build_extension
      _check_call(cmd_get, cwd=pkg_path, env=env)
    File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools_golang.py", line 111, in _check_call
      subprocess.check_call(cmd, cwd=cwd, env=dict(os.environ, **env))
    File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 311, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '('go', 'get', '-d')' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for dockerfile
  Running setup.py clean for dockerfile
Failed to build dockerfile
Installing collected packages: dockerfile
  Attempting uninstall: dockerfile
    Found existing installation: dockerfile 3.1.0
    Uninstalling dockerfile-3.1.0:
      Successfully uninstalled dockerfile-3.1.0
    Running setup.py install for dockerfile: started
    Running setup.py install for dockerfile: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /Users/nmalaguti/git/dockerfile/.tox/py36/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/setup.py'"'"'; __file__='"'"'/private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-record-dw0un84b/install-record.txt --single-version-externally-managed --compile --install-headers /Users/nmalaguti/git/dockerfile/.tox/py36/include/site/python3.6/dockerfile
         cwd: /private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/
    Complete output (46 lines):
    running install
    running build
    running build_ext
    $ GOPATH=/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/tmp42ybfyl8 go get -d
    go: go.mod file not found in current directory or any parent directory; see 'go help modules'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/setup.py", line 36, in <module>
        build_golang={'root': 'github.com/asottile/dockerfile'},
      File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 79, in run
        _build_ext.run(self)
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools_golang.py", line 155, in build_extension
        _check_call(cmd_get, cwd=pkg_path, env=env)
      File "/Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/setuptools_golang.py", line 111, in _check_call
        subprocess.check_call(cmd, cwd=cwd, env=dict(os.environ, **env))
      File "/Users/nmalaguti/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '('go', 'get', '-d')' returned non-zero exit status 1.
    ----------------------------------------
  Rolling back uninstall of dockerfile
  Moving to /Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/dockerfile-3.1.0.dist-info/
   from /Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/~ockerfile-3.1.0.dist-info
  Moving to /Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/dockerfile.abi3.h
   from /private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-uninstall-e0y5vowq/dockerfile.abi3.h
  Moving to /Users/nmalaguti/git/dockerfile/.tox/py36/lib/python3.6/site-packages/dockerfile.abi3.so
   from /private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-uninstall-e0y5vowq/dockerfile.abi3.so
ERROR: Command errored out with exit status 1: /Users/nmalaguti/git/dockerfile/.tox/py36/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/setup.py'"'"'; __file__='"'"'/private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-req-build-cyr5jbkx/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/20/1s3nd7t12wvb0wfxsv0tp9jw0000gn/T/pip-record-dw0un84b/install-record.txt --single-version-externally-managed --compile --install-headers /Users/nmalaguti/git/dockerfile/.tox/py36/include/site/python3.6/dockerfile Check the logs for full command output

Probably a dupe of https://github.com/asottile/setuptools-golang/issues/65

asottile commented 3 years ago

yes it is a dupe