Skip to content

Commit

Permalink
fix: added workaround for windows hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollorion committed Aug 2, 2024
1 parent 2a4b427 commit f2e2161
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions spacemk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
import json
import logging
import subprocess
from importlib.metadata import version
from pathlib import Path
from shutil import which

import gitinfo
from benedict import benedict
from packaging.version import Version as PyPIVersion
from semver import Version as SemVerVersion


def pypi_version_to_semver(version: str) -> str:
pypi_version = PyPIVersion(version)

if pypi_version.dev is not None:
build = gitinfo.get_git_info()["commit"][0:7]
pre = "dev"
elif pypi_version.pre is not None:
build = None
pre_mapping = {"a": "alpha", "b": "beta", "pre": "rc"}
pre = f"{pre_mapping[pypi_version.pre[0]]}{pypi_version.pre[1]}"
else:
pre = None
build = None

return str(SemVerVersion(*pypi_version.release, build=build, prerelease=pre))


__version__ = pypi_version_to_semver(version("spacemk"))
__version__ = "1.0.0"


def ensure_folder_exists(path: Path | str) -> None:
Expand Down

0 comments on commit f2e2161

Please sign in to comment.