Skip to content

Commit

Permalink
Merge pull request #27 from nlpsuge/dev-versions
Browse files Browse the repository at this point in the history
Keep version in a single place and support display version via -v/--version
  • Loading branch information
nlpsuge authored Oct 1, 2021
2 parents 1e5bbc2 + bc1d157 commit c7e3d07
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ Note that this to-do list may not cover all cases.
- [x] Update requirements.txt
- [x] python3-gobject is missing? No.
- [ ] Move Windows from one monitor to another automatically
- [x] Support display version via -v/--version
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@

here = pathlib.Path(__file__).parent.resolve()

# Get the version from xsession_manager/version.py without importing the package (inspired by youtube-dl)
exec(compile(open('xsession_manager/version.py').read(),
'xsession_manager/version.py', 'exec'))

long_description = (here / 'README.md').read_text(encoding='utf-8')

setup(
# pip install xsession-manager
name='xsession-manager',
version='1.0.5',
version=__version__,
description='A command line to save and restore sessions for X11 desktops like Gnome, with many other features',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
5 changes: 5 additions & 0 deletions xsession_manager/arguments_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import sys
from .version import __version__


class ArgumentsParser:
Expand Down Expand Up @@ -57,6 +58,10 @@ def parse_arguments(self):
help='Auto move windows to specified workspaces according to a saved session. '
'The default session is `xsession-default`')

parser.add_argument('-v', '--version',
action='version',
version=__version__)

if len(sys.argv) == 1:
print('No arguments provided.\n')
parser.print_help(sys.stderr)
Expand Down
2 changes: 2 additions & 0 deletions xsession_manager/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

__version__ = '1.0.5'

0 comments on commit c7e3d07

Please sign in to comment.