This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Trying to install a binary extension as a resource file causes pysetup to give a traceback
Type: behavior Stage: resolved
Components: Distutils2, Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder: packaging fails in install_distinfo when writing RESOURCES
View: 12386
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, paul.moore, tarek
Priority: normal Keywords:

Created on 2011-10-12 22:35 by paul.moore, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg145441 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2011-10-12 22:35
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@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
msg145459 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-13 15:42
This does not look related to installing binary files at all, but rather an already known bug: #12386.
History
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57371
2011-10-13 15:42:06eric.araujosetstatus: open -> closed
superseder: packaging fails in install_distinfo when writing RESOURCES
messages: + msg145459

assignee: tarek -> eric.araujo
resolution: duplicate
stage: resolved
2011-10-12 22:35:19paul.moorecreate