Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

Commit 5ee0af0

Browse files
authored
Merge pull request #12 from kshithijiyer/Modifying_version_implementation
Adding centralized version for the tool.
2 parents 5e5494f + 66fda1a commit 5ee0af0

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

pybadges/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from typing import Optional
3737
import urllib.parse
3838
from xml.dom import minidom
39+
from version import __version__
3940

4041
import jinja2
4142
import requests

pybadges/__main__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import sys
2323
import tempfile
2424
import webbrowser
25-
2625
import pybadges
26+
from version import __version__
2727

2828

2929
def main():
@@ -107,7 +107,10 @@ def main():
107107
default=None,
108108
help='the title to associate with the right part of the badge. See '
109109
'https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title')
110-
110+
parser.add_argument(
111+
'-v', '--version',
112+
action='version',
113+
version='%(prog)s {version}'.format(version=__version__))
111114
args = parser.parse_args()
112115

113116
if (args.left_link or args.right_link) and args.whole_link:

pybadges/version.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2019 The pybadge Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
__version__='2.2.0'

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import re
1919

2020
from setuptools import setup
21-
21+
from distutils2 import get_version
2222

2323
def get_long_description():
2424
"""Transform README.md into a usable long description.
@@ -41,7 +41,7 @@ def replace_relative_with_absolute(match):
4141

4242
setup(
4343
name='pybadges',
44-
version='2.2.0',
44+
version= get_version('pybadges/version.py'),
4545
author='Brian Quinlan',
4646
author_email='brian@sweetapp.com',
4747
classifiers=[

0 commit comments

Comments
 (0)