GrahamDumpleton / wrapt

A Python module for decorators, wrappers and monkey patching.
BSD 2-Clause "Simplified" License
2.04k stars 230 forks source link

1.12.1: wrapt is usimg distutils #178

Closed kloczek closed 3 years ago

kloczek commented 3 years ago

I was a bit surprised that after packaging +400 module as rpm packages I found first module which is not using setuptools or pep517 and I was not able to build documentation using setup.py build_sphinx.

+ /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'build_sphinx'

Looks like wrapt is using distutils. I think that it would be good to swotch to setuptools. https://stackoverflow.com/questions/25337706/setuptools-vs-distutils-why-is-distutils-still-a-thing Here is minimal patch which is working for me but it would be good IMO switch fully to setuptools

--- a//setup.py~        2020-03-09 02:31:25.000000000 +0000
+++ b//setup.py 2021-06-05 15:47:12.899054863 +0100
@@ -3,9 +3,9 @@
 import os
 import sys

-from distutils.core import setup
+from setuptools import setup
 from distutils.core import Extension
-from distutils.command.build_ext import build_ext

+from setuptools.command.build_ext import build_ext
 from distutils.errors import (CCompilerError, DistutilsExecError,
                 DistutilsPlatformError)

With that patch I was able to build module and its documentation usimg setuptools

GrahamDumpleton commented 3 years ago

Am trying to enlist via Twitter people to help and/or take over wrapt. From that someone has I believe addressed this issue in a PR that was created. I still need to review the PR and merge it but hope to get to it quickly.

kloczek commented 3 years ago

I would suggest to broadcast that on some python developers forums/mailing lists. I'm still learning python. My patch is only kind of JFDI and by that it needs to be done properly.

GrahamDumpleton commented 3 years ago

Switch to setuptools is done in version 1.13.0.

kloczek commented 3 years ago

Switch to setuptools is done in version 1.13.0.

OK Thx :)