Skip to content

Commit

Permalink
Handle no pyproject file in migration (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Dec 10, 2022
1 parent b743974 commit bf1e5c4
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions hatch_jupyter_builder/migrate/_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,22 @@

# Read pyproject before migration to get old build requirements.
pyproject = Path("pyproject.toml")
data = tomli.loads(pyproject.read_text("utf-8"))
requires = data["build-system"]["requires"]
# Install the old build reqs into this venv.
subprocess.run([sys.executable, "-m", "pip", "install"] + requires)
requires = [
r
for r in requires
if not r.startswith("jupyter-packaging")
and not r.startswith("setuptools")
and not r.startswith("jupyter_packaging")
and not r.startswith("wheel")
]
if pyproject.exists():
data = tomli.loads(pyproject.read_text("utf-8"))
requires = data["build-system"]["requires"]
# Install the old build reqs into this venv.
subprocess.run([sys.executable, "-m", "pip", "install"] + requires)
requires = [
r
for r in requires
if not r.startswith("jupyter-packaging")
and not r.startswith("setuptools")
and not r.startswith("jupyter_packaging")
and not r.startswith("wheel")
]
else:
requires = []


# Extract the current version before beginning any migration.
setup_py = Path("setup.py")
Expand Down

0 comments on commit bf1e5c4

Please sign in to comment.