Skip to content

Commit

Permalink
Merge pull request #1202 from DavidT3/vers/testVersioneer
Browse files Browse the repository at this point in the history
Vers/test versioneer
  • Loading branch information
DavidT3 committed Aug 12, 2024
2 parents 237b821 + f6274ec commit 0f381b1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/publish_to_test_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.12

# The next two chunks set up PIP properly and build the module
- name: Install pypa/build
run: >-
Expand All @@ -54,12 +54,20 @@ jobs:
--wheel
--outdir dist/
.
# Then the module is published to the test PyPI index
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Having a peek
run: >-
ls
- name: Show me the vers
run: >-
python setup.py version
# # Then the module is published to the test PyPI index
# - name: Publish to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/


4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ VCS = git
style = pep440
versionfile_source = xga/_version.py
versionfile_build = xga/_version.py
tag_prefix = 'v'
parentdir_prefix = xga-

tag_prefix = ''
11 changes: 7 additions & 4 deletions xga/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by David J Turner (turne540@msu.edu) 12/08/2024, 16:09. Copyright (c) The Contributors

# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
Expand All @@ -12,12 +15,12 @@
"""Git implementation of _version.py."""

import errno
import functools
import os
import re
import subprocess
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple
import functools


def get_keywords() -> Dict[str, str]:
Expand Down Expand Up @@ -52,7 +55,7 @@ def get_config() -> VersioneerConfig:
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = ""
cfg.parentdir_prefix = "xga-"
cfg.parentdir_prefix = "None"
cfg.versionfile_source = "xga/_version.py"
cfg.verbose = False
return cfg
Expand Down Expand Up @@ -188,6 +191,7 @@ def git_versions_from_keywords(
verbose: bool,
) -> Dict[str, Any]:
"""Get version information from git keywords."""

if "refnames" not in keywords:
raise NotThisMethod("Short version file found")
date = keywords.get("date")
Expand Down Expand Up @@ -284,7 +288,7 @@ def git_pieces_from_vcs(
# if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out, rc = runner(GITS, [
"describe", "--tags", "--dirty", "--always", "--long",
"--match", f"{tag_prefix}[[:digit:]]*"
"--match", f"v*" # TODO THIS IS WHERE I BODGED IT
], cwd=root)
# --long was added in git-1.5.5
if describe_out is None:
Expand Down Expand Up @@ -643,7 +647,6 @@ def get_versions() -> Dict[str, Any]:
# __file__, we can work backwards from there to the root. Some
# py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
# case we can only use expanded keywords.

cfg = get_config()
verbose = cfg.verbose

Expand Down

0 comments on commit 0f381b1

Please sign in to comment.