Skip to content

Commit

Permalink
Merge branch 'hotfix/v0.16.2' #126
Browse files Browse the repository at this point in the history
  • Loading branch information
astrochun committed Nov 17, 2020
2 parents fd61437 + 71851a9 commit 1e1acea
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 30 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ You can confirm installation via `conda list`
(curation) $ conda list ldcoolp
```

You should see that the version is `0.16.1`.
You should see that the version is `0.16.2`.

### Configuration Settings

Expand Down Expand Up @@ -221,7 +221,8 @@ following a `git tag` version.
A list of released features and their issue number(s).
List is sorted from moderate to minor revisions for reach release.
v0.16.0 - v0.16.1:
v0.16.0 - v0.16.2:
* Improved handling of .git set-up in `git_info` #124, #125
* `update` method for `ReadmeClass` to enable updating README.txt file #73, #122
* `update_readme` script to enable easy revision #73
* Scripts are executable #110
Expand Down
2 changes: 1 addition & 1 deletion ldcoolp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from os import path

__version__ = "0.16.1"
__version__ = "0.16.2"

co_path = path.dirname(__file__)

Expand Down
64 changes: 38 additions & 26 deletions ldcoolp/git_info.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
from pathlib import Path


def get_active_branch_name(input_path="."):

head_dir = Path(input_path) / ".git" / "HEAD"
with head_dir.open("r") as f:
content = f.read().splitlines()

for line in content:
if line[0:4] == "ref:":
return line.partition("refs/heads/")[2]


def get_latest_commit(input_path="."):

head_dir = Path(input_path) / ".git" / "HEAD"
with head_dir.open("r") as f:
content = f.read().splitlines()

for line in content:
if line[0:4] == "ref:":
head_path = Path(f".git/{line.partition(' ')[2]}")
with head_path.open('r') as g:
commit = g.read().splitlines()

return commit[0], commit[0][:7] # full and short hash
from os.path import dirname, basename, exists, join

# Get git root
git_root = dirname(__file__.replace(f'/{basename(__file__)}', ''))


def get_active_branch_name(input_path=git_root):
if exists(join(input_path, ".git", "HEAD")):
head_dir = Path(input_path) / ".git" / "HEAD"
with head_dir.open("r") as f:
content = f.read().splitlines()

for line in content:
if line[0:4] == "ref:":
return line.partition("refs/heads/")[2]
else:
return f"HEAD detached : {content[0]}"
else:
return '.git structure does not exist'


def get_latest_commit(input_path=git_root):

if exists(join(input_path, ".git", "HEAD")):
head_dir = Path(input_path) / ".git" / "HEAD"
with head_dir.open("r") as f:
content = f.read().splitlines()

for line in content:
if line[0:4] == "ref:":
head_path = Path(join(input_path, f".git/{line.partition(' ')[2]}"))
with head_path.open('r') as g:
commit = g.read().splitlines()
else:
commit = content
return commit[0], commit[0][:7] # full and short hash
else:
return '.git structure does not exist', ''
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='ldcoolp',
version='v0.16.1',
version='v0.16.2',
packages=['ldcoolp'],
url='https://github.com/ualibraries/LD_Cool_P',
license='MIT License',
Expand Down

0 comments on commit 1e1acea

Please sign in to comment.