Use src-layout. (#600)

This commit is contained in:
Inada Naoki
2023-05-15 23:50:10 +09:00
committed by GitHub
parent abb139bc54
commit 0220f427a9
19 changed files with 11 additions and 8 deletions

View File

@ -29,7 +29,7 @@ jobs:
PIP_DISABLE_PIP_VERSION_CHECK: 1
run: |
pip install -r requirements.txt
python setup.py develop
pip install .
- name: Run tests
env:

View File

@ -1,6 +1,6 @@
.PHONY: build
build:
python3 setup.py build_ext -if
python setup.py build_ext -if
.PHONY: doc
doc:
@ -10,7 +10,7 @@ doc:
.PHONY: clean
clean:
python3 setup.py clean
python setup.py clean
find . -name '*.pyc' -delete
find . -name '__pycache__' -delete
rm -rf build
@ -18,4 +18,4 @@ clean:
.PHONY: check
check:
ruff .
black *.py MySQLdb
black *.py src

View File

@ -1,2 +1,2 @@
ignore:
- "MySQLdb/constants/*"
- "src/MySQLdb/constants/*"

View File

@ -39,10 +39,13 @@ Documentation = "https://mysqlclient.readthedocs.io/"
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
package-dir = {"" = "src"}
[tool.setuptools.packages.find]
namespaces = false
where = ["src"]
include = ["MySQLdb*"]
exclude = ["tests*", "pymysql.tests*"]
[tool.setuptools.dynamic]
version = {attr = "MySQLdb.release.__version__"}

View File

@ -8,7 +8,7 @@ from configparser import ConfigParser
release_info = {}
with open("MySQLdb/release.py", encoding="utf-8") as f:
with open("src/MySQLdb/release.py", encoding="utf-8") as f:
exec(f.read(), None, release_info)
@ -164,7 +164,7 @@ for k, v in ext_options.items():
ext_modules = [
setuptools.Extension(
"MySQLdb._mysql",
sources=["MySQLdb/_mysql.c"],
sources=["src/MySQLdb/_mysql.c"],
**ext_options,
)
]