Skip to content

Commit 94f6937

Browse files
committed
Fixes to allow build artifacts
- Removed a delegating ctor which fails on macOS gcc with error "delegating constructors are permitted only in C++11". - Add version to toml file, required by cibuildwheel (and pyproject.toml specification, I think) and have setup.py file extract it dynamically so we only have to maintain one. I need to determine if the setup keywords are even required or if it will pick up items from the toml file.
1 parent 7b270b8 commit 94f6937

4 files changed

Lines changed: 58 additions & 4 deletions

File tree

.github/workflows/artifacts_build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
# https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job
3535
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
3636
os: [windows-2019, macos-11, ubuntu-22.04]
37-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
3837

3938
steps:
4039
- uses: actions/checkout@v3

pyproject.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
[project]
2+
name = "pyodbc"
3+
version = "5.0.0a2"
4+
5+
requires-python = ">=3.7"
6+
# This is used by the Github action that builds release artifacts using cibuildwheel.
7+
# cibuildwheel reads this directly:
8+
#
9+
# https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python
10+
11+
description = "DB API module for ODBC"
12+
readme = "README.md"
13+
license = {text = "MIT License"}
14+
15+
authors = [{name = "Michael Kleehammer", email="michael@kleehammer.com"}]
16+
17+
maintainers = [{name = "Michael Kleehammer", email="michael@kleehammer.com"}]
18+
# There are a lot of contributors and I'd like to include everyone that puts in a lot of
19+
# effort, but is this for the more technical meaning of who makes builds? Would adding
20+
# contributors cause confusion.
21+
22+
classifiers=['Development Status :: 5 - Production/Stable',
23+
'Intended Audience :: Developers',
24+
'Intended Audience :: System Administrators',
25+
'License :: OSI Approved :: MIT License',
26+
'Operating System :: Microsoft :: Windows',
27+
'Operating System :: POSIX',
28+
'Programming Language :: Python',
29+
'Programming Language :: Python :: 3',
30+
'Topic :: Database',
31+
]
32+
33+
[project.urls]
34+
Homepage = "https://github.com/mkleehammer/pyodbc"
35+
136
[build-system]
237
requires = ["setuptools"]
338
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
#!/usr/bin/env python
22

3-
import sys, os, shlex
3+
import sys, os, shlex, re
44
from os.path import exists, join, isdir, relpath, expanduser
5+
from pathlib import Path
56
from inspect import cleandoc
67

78
from setuptools import setup
89
from setuptools.extension import Extension
910

1011

11-
VERSION = '5.0.0a1'
12+
def _getversion():
13+
# CAREFUL: We need the version in this file so we can set it in a C macro to set
14+
# pyodbc.__version__, plus the setup function might require it. We also need it in the
15+
# toml file or cibuildwheel will fail. Instead of requiring a toml parser for older
16+
# versions of Python, we'll parse it out with a regexp, which is very simple.
17+
path = Path(__file__).parent / 'pyproject.toml'
18+
assert path.exists(), f'Cannot find {path}'
19+
text = path.read_text(encoding='utf8')
20+
m = re.search(
21+
r"""
22+
^ \s* version \s*=\s* "([^"]+)"
23+
""",
24+
text,
25+
flags=re.VERBOSE | re.MULTILINE | re.IGNORECASE)
26+
if not m:
27+
sys.exit(f'Did not find version in {path}')
28+
return m.group(1)
29+
30+
31+
VERSION = _getversion()
1232

1333

1434
def main():

src/textenc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class SQLWChar
8484
}
8585

8686
SQLWChar(PyObject* src, const TextEnc* penc)
87-
: SQLWChar(src, *penc)
8887
{
88+
init(src, *penc);
8989
}
9090

9191
SQLWChar(PyObject* src, const TextEnc& enc)

0 commit comments

Comments
 (0)