[issue35893] distutils fails to build extension on windows when it is a package.__init__

2021-02-03 Thread Steve Dower


Steve Dower  added the comment:

Distutils is now deprecated (see PEP 632) and all tagged issues are being 
closed. From now until removal, only release blocking issues will be considered 
for distutils.

If this issue does not relate to distutils, please remove the component and 
reopen it. If you believe it still requires a fix, most likely the issue should 
be re-reported at https://github.com/pypa/setuptools

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-05-18 Thread Evandro Coan


Evandro Coan  added the comment:

It is missing the import on:

#START
from distutils.command import build_ext

def get_export_symbols(self, ext):
parts = ext.name.split(".")
print('parts', parts)
if parts[-1] == "__init__":
initfunc_name = "PyInit_" + parts[-2]
else:
initfunc_name = "PyInit_" + parts[-1]

build_ext.build_ext.get_export_symbols = get_export_symbols
#END

--
nosy: +evandrocoan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-04 Thread Steve Dower


Steve Dower  added the comment:

Agreed that it should go to setuptools in order to support third-party packages.

In general, those of us who ever touch distutils these days (basically just 
me?) are only really maintaining those parts necessary to build Python and its 
own modules. Since this doesn't impact that scenario, it's not going to get 
much attention until there's at least a PR and tests to review.

--
versions: +Python 2.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-04 Thread Paul Ganssle

Paul Ganssle  added the comment:

Well, there's some tentative plan for `setuptools` to completely adopt 
distutils, so in some sense all distutils bugs are setuptools bugs as well.

That said, the reason to report it in setuptools as well is that setuptools 
still supports Python 2.7, 3.5 and 3.6, so even if this bug is fixed in the 
standard library, it still needs to be fixed in setuptools.

Of course it may not be easy or feasible to fix it in setuptools until *after* 
we fully adopt distutils, but ¯\_(ツ)_/¯ might as well still report it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-04 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

The bug is the stdlib, and I've checked that setuptools just calls the code in 
distutils in this case.

IMHO it would be better to fix this in the stdlib.

(Unselecting python 3.6 because that's in security-only mode by now)

--
versions:  -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-04 Thread Paul Ganssle


Paul Ganssle  added the comment:

@Ronald Ah, interesting, I missed that.

In my experience, distutils is pretty static and it's not particularly common 
to merge changes into it. Whether or not this is in scope for distutils, it's 
definitely in scope for setuptools - do you mind opening an issue on the 
setuptools tracker? https://github.com/pypa/setuptools

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-04 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

@Paul, modulegraph2 uses flit, but I do use setuptools to build extensions in 
the test suite.  The problematic setup.py file is in testsuite/nodebuilder-tree.

I do have a workaround in that setup.py:

# START
def get_export_symbols(self, ext):
parts = ext.name.split(".")
if parts[-1] == "__init__":
initfunc_name = "PyInit_" + parts[-2]
else:
initfunc_name = "PyInit_" + parts[-1]


build_ext.build_ext.get_export_symbols = get_export_symbols
# END

Creating a PR from this would be easy, but IMHO there should be a new test case 
as well.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-04 Thread Paul Ganssle


Paul Ganssle  added the comment:

@Ronald The module you've linked to seems to be using flit and doesn't have any 
C extensions. Did you change over the build process, or am I missing something?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-04 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-03 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

FWIW the project in question is modulegraph2 
, which almost 
works on Windows, except for this issue and some incorrect code on my side that 
assumes virtualenv on Windows behaves the same as on POSIX w.r.t. the structure 
of virtual environments.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35893] distutils fails to build extension on windows when it is a package.__init__

2019-02-03 Thread Ronald Oussoren


New submission from Ronald Oussoren :

Python supports having a C extension for the the __init__ of a package (instead 
of having __init__.py). This works fine on Linux, but on Windows distutils 
fails to build the C extension because it assumes the entry point is named 
PyInit___init__ while importlib expects PyInit_*package* (for a package named 
*package*). 

When building the extension I get the following error:

LINK : error LNK2001: unresolved external symbol PyInit___init__
build\temp.win32-3.7\Release\__init__.cp37-win32.lib : fatal error LNK1120: 1 
unresolved externals


The code below can be used to reproduce the issue.

Setup.py (extracted from a larger setup.py, but should work...):

from setuptools import setup, Extension
extension3 = Extension("ext_package.__init__", sources=["init.c"])

setup(
ext_modules=[extension3],
)

Source code for the module (init.c):

#include "Python.h"
  

static PyModuleDef mod_def = {
PyModuleDef_HEAD_INIT,
"ext_package.__init__",
NULL,
0,
NULL,
NULL,
NULL,
NULL,
NULL
};

PyObject* PyInit_ext_package(void)
{
return PyModule_Create(_def);
}


P.S. I cannot easily debug this, I ran into this when testing one of my 
projects on AppVeyor and don't have a local Windows machine.

--
components: Distutils, Windows
messages: 334800
nosy: dstufft, eric.araujo, paul.moore, ronaldoussoren, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: distutils fails to build extension on windows when it is a 
package.__init__
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com