Title: bpo-36146: Refactor setup.py by vstinner · Pull Request #12068 · python/cpython · GitHub
Open Graph Title: bpo-36146: Refactor setup.py by vstinner · Pull Request #12068 · python/cpython
X Title: bpo-36146: Refactor setup.py by vstinner · Pull Request #12068 · python/cpython
Description: The detect_modules() method of setup.py became longer and longer over the years. It is now 1128 lines long. It's way too long: it becomes very hard to track the lifetime of a variable and many variables are overriden on purpose or not. Shorter functions help to track the lifetime of variables, ease review and reduce the number of bugs. Changes: Fix detect_ctypes(): it no longer modifies global inc_dirs on macOS self.srcdir is now always an absolute path Add MACOS and MS_WINDOWS constants Add TEST_EXTENSIONS to allow to not build extensions used to test Python (ex: _testcapi) Add MATH_LIBS which is the libm library Other refactoring changes: Reorder imports Replace "from distutils.errors import *" with "from distutils.errors import CCompilerError, DistutilsError" to be able to use static analyzers like pyflakes Rename globals to upper case to better distinguish if a variable is global or locale: Rename cross_compiling to CROSS_COMPILING Rename host_platform to HOST_PLATFORM Rename disabled_module_list to DISABLED_MODULE_LIST Don't run code at module top level, but at the beginning of main() Move 'missing' and 'srcdir' from detect_modules() local variable to PyBuildExt attributes Remove exts local variable from detect_modules(): add add_ext() method which append directly the module to self.extensions. _detect_openssl() and _detect_nis() now directly add the extension and have no return value. Split very long detect_modules() method into subfunctions, add many "detect_xxx" methods. https://bugs.python.org/issue36146
Open Graph Description: The detect_modules() method of setup.py became longer and longer over the years. It is now 1128 lines long. It's way too long: it becomes very hard to track the lifetime of a variable and many ...
X Description: The detect_modules() method of setup.py became longer and longer over the years. It is now 1128 lines long. It's way too long: it becomes very hard to track the lifetime of a variable and m...
Opengraph URL: https://github.com/python/cpython/pull/12068
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:36d49969-7ff6-f80d-d480-d17ac910dbe0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8BC8:215443:1F8557:29D42F:6A52F0DA |
| html-safe-nonce | ede069cf2a28f3ad67d5b1fae7a280a0ce1119a50c066ab62c82566b99bd5495 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QkM4OjIxNTQ0MzoxRjg1NTc6MjlENDJGOjZBNTJGMERBIiwidmlzaXRvcl9pZCI6IjE1Mzk5NTQ2NTg4MzkyOTQxNzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c35b467add7cc36942277d9ab807adde38684c6a27b3be3eaf797a6e9867fda2 |
| hovercard-subject-tag | pull_request:256666838 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/12068/files |
| twitter:image | https://avatars.githubusercontent.com/u/194129?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/194129?s=400&v=4 |
| og:image:alt | The detect_modules() method of setup.py became longer and longer over the years. It is now 1128 lines long. It's way too long: it becomes very hard to track the lifetime of a variable and many ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width