From f595c3d400af242c46a4f1c19dcd65a6b49ea5ee Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Thu, 11 Feb 2021 19:18:18 -0500 Subject: [PATCH] Changing version in setup.py changes everywhere --- contrib/manconvert | 7 +++++-- contrib/version-switch | 6 ------ lightcards/runner.py | 6 +++++- man/lightcards.1.md | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) delete mode 100755 contrib/version-switch diff --git a/contrib/manconvert b/contrib/manconvert index 6553637..8c4afbf 100755 --- a/contrib/manconvert +++ b/contrib/manconvert @@ -1,4 +1,7 @@ #!/usr/bin/env sh -for i in man/*; do - pandoc ${i} -s -t man -o $(echo ${i} | cut -d '.' -f -2) +find man/*.md | \ +while read i; do + base=$(echo ${i} | cut -d '.' -f -2) + pandoc ${i} -s -t man -o ${base} + sed -i "s/VERSION_HERE/$(python3 -m lightcards -v)/g" ${base} done diff --git a/contrib/version-switch b/contrib/version-switch deleted file mode 100755 index 7f92a2a..0000000 --- a/contrib/version-switch +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -current=$(git tag | tail -n 1 | tail -c +2) -grep -rl --exclude-dir=.git ${current} | \ - while read line; do - sed -i "s/${current}/${1}/g" ${line} - done diff --git a/lightcards/runner.py b/lightcards/runner.py index 35651f9..f9f1abd 100644 --- a/lightcards/runner.py +++ b/lightcards/runner.py @@ -4,6 +4,7 @@ import argparse from curses import wrapper import os +import pkg_resources from random import shuffle import sys @@ -40,7 +41,10 @@ def parse_args(): "-s", "--shuffle", action="store_true", help="shuffle card order" ) parser.add_argument( - "-v", "--version", action="version", version="lightcards 0.6.0" + "-v", + "--version", + action="version", + version=f"lightcards {pkg_resources.require('lightcards')[0].version}", ) return parser.parse_args() diff --git a/man/lightcards.1.md b/man/lightcards.1.md index d3813f6..96b62ee 100644 --- a/man/lightcards.1.md +++ b/man/lightcards.1.md @@ -2,7 +2,7 @@ title: lightcards section: 1 header: General Commands Manual -footer: lightcards 0.6.0 +footer: VERSION_HERE date: February 2021 --- -- 2.39.2