Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #39 from kevinywlui/develop
Browse files Browse the repository at this point in the history
Actually install the cheat sheet when using setup.py
  • Loading branch information
vbraun authored Jul 7, 2019
2 parents 2fd52e5 + c981690 commit da5a902
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions git_trac/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,27 @@ def xdg_open(uri):


def show_cheat_sheet():
# case where `git-trac` was just symbolically linked
root_dir = os.path.dirname(os.path.dirname(__file__))
cheat_sheet = os.path.join(root_dir, 'doc', 'git-cheat-sheet.pdf')
# case of `python setup.py install --user`
if not os.path.exists(cheat_sheet):
root_dir = __import__('site').USER_BASE
cheat_sheet = os.path.join(root_dir,
'share',
'git-trac-command',
'git-cheat-sheet.pdf')
# case of `python setup.py install`
if not os.path.exists(cheat_sheet):
root_dir = sys.prefix
cheat_sheet = os.path.join(root_dir,
'share',
'git-trac-command',
'git-cheat-sheet.pdf')
# go to internet if not found
if not os.path.exists(cheat_sheet):
cheat_sheet = "http://github.com/sagemath/git-trac-command/raw/master/doc/git-cheat-sheet.pdf"
print('Cheat sheet not found locally. Trying the internet.')
xdg_open(cheat_sheet)


Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
author='Volker Braun',
author_email='[email protected]',
packages=['git_trac'],
data_files=[('share/git-trac-command', ['doc/git-cheat-sheet.pdf'])],
scripts=['git-trac'],
version='1.0',
url='https://github.com/sagemath/git-trac-command',
Expand Down

0 comments on commit da5a902

Please sign in to comment.