[New-bugs-announce] [issue13162] Trying to install a binary extension as a resource file causes pysetup to give a traceback

Paul Moore report at bugs.python.org
Thu Oct 13 00:35:20 CEST 2011


New submission from Paul Moore <p.f.moore at gmail.com>:

I am trying to create a pysetup package that contains a precompiled binary extension, which can be installed without compiling, by using the resource file feature of setup.cfg. This may be incorrect usage of pysetup, but at a minimum, a proper error message should be given rather than a traceback.

With a directory containing an extension hello.pyd plus the following setup.cfg file:

[metadata]
name = hello
version = 0.1
author = Paul Moore
author-email = p.f.moore at gmail.com
summary = Test C extension

[files]
resources =
    hello.pyd = {platlib}

I get a traceback when I do pysetup install:

PS D:\Data\python-sample\bin> pysetup install
Installing from source directory: 'D:\\Data\\python-sample\\bin'
running install_dist
running build
running install_data
running install_distinfo
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\METADATA
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\INSTALLER
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\REQUESTED
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\RESOURCES
Traceback (most recent call last):
  File "D:\Data\cpython\lib\runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "D:\Data\cpython\lib\runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "D:\Data\cpython\lib\packaging\run.py", line 666, in <module>
    sys.exit(main())
  File "D:\Data\cpython\lib\packaging\run.py", line 653, in main
    return dispatcher()
  File "D:\Data\cpython\lib\packaging\run.py", line 642, in __call__
    return func(self, self.args)
  File "D:\Data\cpython\lib\packaging\run.py", line 91, in wrapper
    return f(*args, **kwargs)
  File "D:\Data\cpython\lib\packaging\run.py", line 164, in _install
    return not install_local_project(target)
  File "D:\Data\cpython\lib\packaging\install.py", line 122, in install_local_project
    return _run_install_from_dir(path)
  File "D:\Data\cpython\lib\packaging\install.py", line 160, in _run_install_from_dir
    func(source_dir)
  File "D:\Data\cpython\lib\packaging\install.py", line 87, in _run_packaging_install
    dist.run_command('install_dist')
  File "D:\Data\cpython\lib\packaging\dist.py", line 709, in run_command
    cmd_obj.run()
  File "D:\Data\cpython\lib\packaging\command\install_dist.py", line 506, in run
    self.run_command(cmd_name)
  File "D:\Data\cpython\lib\packaging\command\cmd.py", line 330, in run_command
    self.distribution.run_command(command)
  File "D:\Data\cpython\lib\packaging\dist.py", line 709, in run_command
    cmd_obj.run()
  File "D:\Data\cpython\lib\packaging\command\install_distinfo.py", line 112, in run
    writer.writerow(row)
TypeError: 'str' does not support the buffer interface

If this configuration is invalid a better error message should be given. However, I would also like to know what (if any) would be the correct way of writing a setup.cfg file to install a compiled extension like this.

For background on why I am trying to do things in this (odd) way, see the python-dev thread starting at http://mail.python.org/pipermail/python-dev/2011-October/113956.html

----------
assignee: tarek
components: Distutils2, Library (Lib)
messages: 145441
nosy: alexis, eric.araujo, pmoore, tarek
priority: normal
severity: normal
status: open
title: Trying to install a binary extension as a resource file causes pysetup to give a traceback
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13162>
_______________________________________


More information about the New-bugs-announce mailing list