Skip to content

Commit ef593d6

Browse files
committed
add build_py to cmdclass
distutils has also been deprecated
1 parent c8e3f74 commit ef593d6

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

noxfile.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def example(session: Session) -> None:
9898
def docs(session: Session) -> None:
9999
"""Build and display documentation in the browser (automatically reloads on change)"""
100100
install_requirements_file(session, "build-docs")
101-
install_idom_dev(session, extras="all")
101+
install_idom_dev(session)
102102
session.run(
103103
"python",
104104
"scripts/live_docs.py",
@@ -188,7 +188,7 @@ def test_python_suite(session: Session) -> None:
188188
session.install(".[all]")
189189
else:
190190
posargs += ["--cov=src/idom", "--cov-report", "term"]
191-
install_idom_dev(session, extras="all")
191+
install_idom_dev(session)
192192

193193
session.run("pytest", *posargs)
194194

@@ -234,7 +234,7 @@ def test_python_build(session: Session) -> None:
234234
def test_docs(session: Session) -> None:
235235
"""Verify that the docs build and that doctests pass"""
236236
install_requirements_file(session, "build-docs")
237-
install_idom_dev(session, extras="all")
237+
install_idom_dev(session)
238238
session.run(
239239
"sphinx-build",
240240
"-a", # re-write all output files
@@ -370,7 +370,8 @@ def install_requirements_file(session: Session, name: str) -> None:
370370
session.install("-r", str(file_path))
371371

372372

373-
def install_idom_dev(session: Session, extras: str = "stable") -> None:
373+
def install_idom_dev(session: Session, extras: str = "all") -> None:
374+
session.run("pip", "--version")
374375
if "--no-install" not in session.posargs:
375376
session.install("-e", f".[{extras}]")
376377
else:

requirements/pkg-extras.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ uvicorn[standard] >=0.13.4
1212

1313
# extra=flask
1414
flask
15-
markupsafe<2.1
15+
markupsafe>=1.1.1,<2.1
1616
flask-cors
1717
flask-sock
1818

setup.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
import subprocess
66
import sys
77
import traceback
8-
from distutils import log
9-
from distutils.command.build import build # type: ignore
10-
from distutils.command.sdist import sdist # type: ignore
8+
from logging import StreamHandler, getLogger
119
from pathlib import Path
1210

1311
from setuptools import find_packages, setup
1412
from setuptools.command.develop import develop
13+
from setuptools.command.sdist import sdist
1514

1615

1716
if sys.platform == "win32":
@@ -22,6 +21,15 @@ def list2cmdline(cmd_list):
2221
return " ".join(map(pipes.quote, cmd_list))
2322

2423

24+
log = getLogger()
25+
log.addHandler(StreamHandler(sys.stdout))
26+
27+
28+
# -----------------------------------------------------------------------------
29+
# Basic Constants
30+
# -----------------------------------------------------------------------------
31+
32+
2533
# the name of the project
2634
NAME = "idom"
2735

@@ -167,10 +175,18 @@ def run(self):
167175

168176
package["cmdclass"] = {
169177
"sdist": build_javascript_first(sdist),
170-
"build": build_javascript_first(build),
171178
"develop": build_javascript_first(develop),
172179
}
173180

181+
if sys.version_info < (3, 10, 6):
182+
from distutils.command.build import build
183+
184+
package["cmdclass"]["build"] = build_javascript_first(build)
185+
else:
186+
from setuptools.command.build_py import build_py
187+
188+
package["cmdclass"]["build_py"] = build_javascript_first(build_py)
189+
174190

175191
# -----------------------------------------------------------------------------
176192
# Install It

0 commit comments

Comments
 (0)