Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a setup.py shim in migration script #27

Merged
merged 2 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion hatch_jupyter_builder/migration/_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
build_table = hatch_table.setdefault("build", {})
targets_table = build_table.setdefault("targets", {})

# Remove the dynamic version.
if current_version:
del hatch_table["version"]

# Remove any auto-generated sdist config.
if "sdist" in targets_table:
del targets_table["sdist"]
Expand Down Expand Up @@ -182,8 +186,14 @@
if npm_version == current_version:
tbump_table["file"].append(dict(src="package.json"))

# Add a setup.py shim.
shim_text = """# setup.py shim for use with applications that require it.
__import__("setuptools").setup()
"""
setup_py.write_text(shim_text, encoding="utf-8")

# Remove old files
for fname in ["MANIFEST.in", "setup.py", "setup.cfg"]:
for fname in ["MANIFEST.in", "setup.cfg"]:
if os.path.exists(fname):
os.remove(fname)

Expand Down
3 changes: 0 additions & 3 deletions tests/data/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ version = "0.1.0"
[project.urls]
Homepage = "https://github.com/github_username/myextension"

[tool.hatch.version]
path = "myextension/__init__.py"

[tool.hatch.build]
artifacts = [
"myextension/labextension",
Expand Down