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 PIP_DISABLE_PIP_VERSION_CHECK: 1
run: | run: |
pip install -r requirements.txt pip install -r requirements.txt
python setup.py develop pip install .
- name: Run tests - name: Run tests
env: env:

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ from configparser import ConfigParser
release_info = {} 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) exec(f.read(), None, release_info)
@ -164,7 +164,7 @@ for k, v in ext_options.items():
ext_modules = [ ext_modules = [
setuptools.Extension( setuptools.Extension(
"MySQLdb._mysql", "MySQLdb._mysql",
sources=["MySQLdb/_mysql.c"], sources=["src/MySQLdb/_mysql.c"],
**ext_options, **ext_options,
) )
] ]