From 2ea9d5697371ed9c75bf9bb6f60324cc8202ff4a Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Mon, 15 May 2023 19:06:39 +0900 Subject: [PATCH 1/3] Use src-layout. --- Makefile | 6 +++--- codecov.yml | 2 +- pyproject.toml | 2 +- setup.py | 4 ++-- {MySQLdb => src/MySQLdb}/__init__.py | 0 {MySQLdb => src/MySQLdb}/_exceptions.py | 0 {MySQLdb => src/MySQLdb}/_mysql.c | 0 {MySQLdb => src/MySQLdb}/connections.py | 0 {MySQLdb => src/MySQLdb}/constants/CLIENT.py | 0 {MySQLdb => src/MySQLdb}/constants/CR.py | 0 {MySQLdb => src/MySQLdb}/constants/ER.py | 0 {MySQLdb => src/MySQLdb}/constants/FIELD_TYPE.py | 0 {MySQLdb => src/MySQLdb}/constants/FLAG.py | 0 {MySQLdb => src/MySQLdb}/constants/__init__.py | 0 {MySQLdb => src/MySQLdb}/converters.py | 0 {MySQLdb => src/MySQLdb}/cursors.py | 0 {MySQLdb => src/MySQLdb}/release.py | 0 {MySQLdb => src/MySQLdb}/times.py | 0 18 files changed, 7 insertions(+), 7 deletions(-) rename {MySQLdb => src/MySQLdb}/__init__.py (100%) rename {MySQLdb => src/MySQLdb}/_exceptions.py (100%) rename {MySQLdb => src/MySQLdb}/_mysql.c (100%) rename {MySQLdb => src/MySQLdb}/connections.py (100%) rename {MySQLdb => src/MySQLdb}/constants/CLIENT.py (100%) rename {MySQLdb => src/MySQLdb}/constants/CR.py (100%) rename {MySQLdb => src/MySQLdb}/constants/ER.py (100%) rename {MySQLdb => src/MySQLdb}/constants/FIELD_TYPE.py (100%) rename {MySQLdb => src/MySQLdb}/constants/FLAG.py (100%) rename {MySQLdb => src/MySQLdb}/constants/__init__.py (100%) rename {MySQLdb => src/MySQLdb}/converters.py (100%) rename {MySQLdb => src/MySQLdb}/cursors.py (100%) rename {MySQLdb => src/MySQLdb}/release.py (100%) rename {MySQLdb => src/MySQLdb}/times.py (100%) diff --git a/Makefile b/Makefile index 850e296e..f0e94c3b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/codecov.yml b/codecov.yml index 174a4994..014486d2 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,2 +1,2 @@ ignore: - - "MySQLdb/constants/*" + - "src/MySQLdb/constants/*" diff --git a/pyproject.toml b/pyproject.toml index 907bf55f..a5867699 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,8 +41,8 @@ build-backend = "setuptools.build_meta" [tool.setuptools.packages.find] namespaces = false +where = ["src"] include = ["MySQLdb*"] -exclude = ["tests*", "pymysql.tests*"] [tool.setuptools.dynamic] version = {attr = "MySQLdb.release.__version__"} diff --git a/setup.py b/setup.py index 368617ef..5594df54 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ 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 @@ def get_options(): ext_modules = [ setuptools.Extension( "MySQLdb._mysql", - sources=["MySQLdb/_mysql.c"], + sources=["src/MySQLdb/_mysql.c"], **ext_options, ) ] diff --git a/MySQLdb/__init__.py b/src/MySQLdb/__init__.py similarity index 100% rename from MySQLdb/__init__.py rename to src/MySQLdb/__init__.py diff --git a/MySQLdb/_exceptions.py b/src/MySQLdb/_exceptions.py similarity index 100% rename from MySQLdb/_exceptions.py rename to src/MySQLdb/_exceptions.py diff --git a/MySQLdb/_mysql.c b/src/MySQLdb/_mysql.c similarity index 100% rename from MySQLdb/_mysql.c rename to src/MySQLdb/_mysql.c diff --git a/MySQLdb/connections.py b/src/MySQLdb/connections.py similarity index 100% rename from MySQLdb/connections.py rename to src/MySQLdb/connections.py diff --git a/MySQLdb/constants/CLIENT.py b/src/MySQLdb/constants/CLIENT.py similarity index 100% rename from MySQLdb/constants/CLIENT.py rename to src/MySQLdb/constants/CLIENT.py diff --git a/MySQLdb/constants/CR.py b/src/MySQLdb/constants/CR.py similarity index 100% rename from MySQLdb/constants/CR.py rename to src/MySQLdb/constants/CR.py diff --git a/MySQLdb/constants/ER.py b/src/MySQLdb/constants/ER.py similarity index 100% rename from MySQLdb/constants/ER.py rename to src/MySQLdb/constants/ER.py diff --git a/MySQLdb/constants/FIELD_TYPE.py b/src/MySQLdb/constants/FIELD_TYPE.py similarity index 100% rename from MySQLdb/constants/FIELD_TYPE.py rename to src/MySQLdb/constants/FIELD_TYPE.py diff --git a/MySQLdb/constants/FLAG.py b/src/MySQLdb/constants/FLAG.py similarity index 100% rename from MySQLdb/constants/FLAG.py rename to src/MySQLdb/constants/FLAG.py diff --git a/MySQLdb/constants/__init__.py b/src/MySQLdb/constants/__init__.py similarity index 100% rename from MySQLdb/constants/__init__.py rename to src/MySQLdb/constants/__init__.py diff --git a/MySQLdb/converters.py b/src/MySQLdb/converters.py similarity index 100% rename from MySQLdb/converters.py rename to src/MySQLdb/converters.py diff --git a/MySQLdb/cursors.py b/src/MySQLdb/cursors.py similarity index 100% rename from MySQLdb/cursors.py rename to src/MySQLdb/cursors.py diff --git a/MySQLdb/release.py b/src/MySQLdb/release.py similarity index 100% rename from MySQLdb/release.py rename to src/MySQLdb/release.py diff --git a/MySQLdb/times.py b/src/MySQLdb/times.py similarity index 100% rename from MySQLdb/times.py rename to src/MySQLdb/times.py From 9785f0268d16398e714b81eae86da1d622dd15cc Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Mon, 15 May 2023 19:32:14 +0900 Subject: [PATCH 2/3] fixup --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a5867699..3bfd1f6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,9 @@ 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"] From 757ae1eb47c6631ec08a0754a42684330634be7a Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Mon, 15 May 2023 19:38:27 +0900 Subject: [PATCH 3/3] fix --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 73681427..31ee34d3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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: