Skip to content

Commit b193f22

Browse files
authored
Revert changes to make changelog pr (#364)
1 parent 6e5b438 commit b193f22

File tree

4 files changed

+15
-33
lines changed

4 files changed

+15
-33
lines changed

jupyter_releaser/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ def check_npm(dist_dir, npm_install_options):
459459
@use_checkout_dir()
460460
def check_manifest():
461461
"""Check the project manifest"""
462-
# Only run the check if we're using setuptools
463-
if util.SETUP_PY.exists() or util.MANIFEST.exists():
462+
# Only run the check if we have a manifest file.
463+
if util.MANIFEST.exists():
464464
util.run("check-manifest -v")
465465
else:
466466
util.log("Skipping check-manifest since there are no python package files")

jupyter_releaser/lib.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,15 @@ def make_changelog_pr(auth, branch, repo, title, commit_message, body, dry_run=F
163163

164164
# Make a new branch with a uuid suffix
165165
pr_branch = f"changelog-{uuid.uuid1().hex}"
166-
util.run(f"{util.GIT_FETCH_CMD} {branch}", echo=True)
167-
dirty = False
168-
try:
169-
util.run("git stash", echo=True)
170-
dirty = True
171-
except Exception:
172-
pass
173-
util.run(f"git checkout -b {pr_branch} origin/{branch}", echo=True)
174-
if dirty:
175-
if dry_run:
176-
util.run("git merge --squash --strategy-option=theirs stash", echo=True)
177-
else:
178-
util.run("git stash apply", echo=True)
166+
167+
if not dry_run:
168+
dirty = util.run("git --no-pager diff --stat") != ""
169+
if dirty:
170+
util.run("git stash")
171+
util.run(f"{util.GIT_FETCH_CMD} {branch}")
172+
util.run(f"git checkout -b {pr_branch} origin/{branch}")
173+
if dirty:
174+
util.run("git stash apply")
179175

180176
# Add a commit with the message
181177
try:
@@ -192,8 +188,8 @@ def make_changelog_pr(auth, branch, repo, title, commit_message, body, dry_run=F
192188
head = pr_branch
193189
maintainer_can_modify = True
194190

195-
remote_name = util.get_remote_name(dry_run)
196-
util.run(f"git push {remote_name} {pr_branch}", echo=True)
191+
if not dry_run:
192+
util.run(f"git push origin {pr_branch}", echo=True)
197193

198194
# title, head, base, body, maintainer_can_modify, draft, issue
199195
pull = gh.pulls.create(title, head, base, body, maintainer_can_modify, False, None)

jupyter_releaser/tests/test_cli.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -443,17 +443,6 @@ def test_check_python_resource_path(monkeypatch, py_package, runner, build_mock,
443443
path = bar_dir / "baz.txt"
444444
path.write_text("hello", encoding="utf-8")
445445

446-
manifest = Path(util.CHECKOUT_NAME) / "MANIFEST.in"
447-
manifest_text = manifest.read_text(encoding="utf-8")
448-
manifest_text += "\ninclude foo/bar/baz.txt\n"
449-
manifest.write_text(manifest_text, encoding="utf-8")
450-
451-
setup_cfg_path = Path(util.CHECKOUT_NAME) / "setup.cfg"
452-
setup_cfg_text = setup_cfg_path.read_text(encoding="utf-8")
453-
setup_cfg_text = setup_cfg_text.replace("foo.__version__", "foo.__init__.__version__")
454-
setup_cfg_text = setup_cfg_text.replace("py_modules = foo", "")
455-
setup_cfg_path.write_text(setup_cfg_text, encoding="utf-8")
456-
457446
runner(["build-python"])
458447
runner(["check-python"])
459448

jupyter_releaser/tests/util.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def pyproject_template(project_name="foo", sub_packages=None):
9191
sub_packages = sub_packages or []
9292
res = f"""
9393
[build-system]
94-
requires = ["setuptools>=61.0.0", "wheel"]
95-
build-backend = "setuptools.build_meta"
94+
requires = ["hatchling>=1.5.0"]
95+
build-backend = "hatchling.build"
9696
9797
[project]
9898
name = "{project_name}"
@@ -227,9 +227,6 @@ def write_files(git_repo, sub_packages=None, package_name="foo", module_name=Non
227227
foopy = git_repo / f"{module_name}.py"
228228
foopy.write_text(PY_MODULE_TEMPLATE, encoding="utf-8")
229229

230-
manifest = git_repo / "MANIFEST.in"
231-
manifest.write_text(MANIFEST_TEMPLATE, encoding="utf-8")
232-
233230
license = git_repo / "LICENSE"
234231
license.write_text(LICENSE_TEMPLATE, encoding="utf-8")
235232

0 commit comments

Comments
 (0)