Skip to content

Commit

Permalink
Fixes to allow build artifacts
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
mkleehammer committed Aug 26, 2023
1 parent 7b270b8 commit 94f6937
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/artifacts_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
# https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
os: [windows-2019, macos-11, ubuntu-22.04]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
35 changes: 35 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
[project]
name = "pyodbc"
version = "5.0.0a2"

requires-python = ">=3.7"
# This is used by the Github action that builds release artifacts using cibuildwheel.
# cibuildwheel reads this directly:
#
# https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python

description = "DB API module for ODBC"
readme = "README.md"
license = {text = "MIT License"}

authors = [{name = "Michael Kleehammer", email="[email protected]"}]

maintainers = [{name = "Michael Kleehammer", email="[email protected]"}]
# There are a lot of contributors and I'd like to include everyone that puts in a lot of
# effort, but is this for the more technical meaning of who makes builds? Would adding
# contributors cause confusion.

classifiers=['Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Database',
]

[project.urls]
Homepage = "https://github.com/mkleehammer/pyodbc"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
24 changes: 22 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
#!/usr/bin/env python

import sys, os, shlex
import sys, os, shlex, re
from os.path import exists, join, isdir, relpath, expanduser
from pathlib import Path
from inspect import cleandoc

from setuptools import setup
from setuptools.extension import Extension


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


VERSION = _getversion()


def main():
Expand Down
2 changes: 1 addition & 1 deletion src/textenc.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class SQLWChar
}

SQLWChar(PyObject* src, const TextEnc* penc)
: SQLWChar(src, *penc)
{
init(src, *penc);
}

SQLWChar(PyObject* src, const TextEnc& enc)
Expand Down

0 comments on commit 94f6937

Please sign in to comment.