Skip to content

Commit ff6fde4

Browse files
authored
Merge pull request #10 from yeger00/adding-__version__.py-file
adding __version__.py file
2 parents 1b84895 + 8ce1452 commit ff6fde4

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

graphdiff/__main__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22
import sys
33
import pydot
4-
import graphdiff
5-
4+
import argparse
5+
from . import graphdiff
6+
from . import __version__ as version
67

78
def load_graph(path):
89
'''
@@ -29,8 +30,14 @@ def print_graph(graph):
2930

3031

3132
def main():
32-
before_graph = load_graph(sys.argv[1])
33-
after_graph = load_graph(sys.argv[2])
33+
parser = argparse.ArgumentParser(description='graph-diff')
34+
parser.add_argument('--version', action='version', version=version.__version__)
35+
parser.add_argument('before', action='store')
36+
parser.add_argument('after', action='store')
37+
args = parser.parse_args()
38+
39+
before_graph = load_graph(args.before)
40+
after_graph = load_graph(args.after)
3441
diff = graphdiff.generate_diff_graph(before_graph, after_graph)
3542
print_graph(diff)
3643

graphdiff/__version__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
__version__ = '0.0.6'
2+
__title__ = 'graphdiff'
3+
__description__ = ''
4+
__url__ = 'https://github.com/yeger00/'
5+
__author__ = 'Avi Yeger'
6+
__author_email__ = 'yeger00@gmail.com'
7+
__license__ = 'MIT'

setup.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
#!/usr/bin/env python
22
import sys
3+
import os
34

45
from setuptools import setup, find_packages
56
from setuptools.command.test import test as TestCommand
67

7-
with open("README.md", "r") as fh:
8-
long_description = fh.read()
8+
here = os.path.abspath(os.path.dirname(__file__))
9+
about = {}
10+
11+
with open(os.path.join(here, 'graphdiff', '__version__.py'), 'r') as f:
12+
exec(f.read(), about)
13+
14+
with open('README.md', 'r') as f:
15+
long_description = f.read()
916

1017
class PyTest(TestCommand):
1118
user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]
@@ -21,17 +28,17 @@ def run_tests(self):
2128
sys.exit(errno)
2229

2330
setup(
24-
name="graphdiff",
25-
version="0.0.5",
26-
author="Avi Yeger",
27-
author_email="yeger00@gmail.com",
28-
description="",
31+
name=about['__title__'],
32+
version=about['__version__'],
33+
author=about['__author__'],
34+
author_email=about['__author_email__'],
35+
description=about['__description__'],
2936
long_description=long_description,
30-
long_description_content_type="text/markdown",
31-
url="https://github.com/yeger00/",
37+
long_description_content_type='text/markdown',
38+
url=about['__url__'],
3239
packages=find_packages(),
33-
install_requires=["pydot"],
34-
tests_require=["pytest", "pytest_mock"],
35-
cmdclass={"test": PyTest},
36-
scripts=["bin/graph-diff", "bin/graph-diff-color", "bin/git-graph-diff-tool"]
40+
install_requires=['pydot'],
41+
tests_require=['pytest', 'pytest_mock'],
42+
cmdclass={'test': PyTest},
43+
scripts=['bin/graph-diff', 'bin/graph-diff-color', 'bin/git-graph-diff-tool']
3744
)

0 commit comments

Comments
 (0)