Cheatsheets are now package data for new cheatlib package

This commit is contained in:
Jeffrey Lund 2013-08-20 16:09:39 -07:00
parent de2471b93a
commit 027354474f
27 changed files with 9 additions and 4 deletions

6
cheat
View File

@ -1,10 +1,16 @@
#!/usr/bin/env python
import os
import pkg_resources
import sys
# assembles a list of directories containing cheatsheets
def cheat_directories():
paths = [os.path.expanduser('~/.cheat')]
try:
paths.append(pkg_resources.resource_filename('cheatlib', 'cheatsheets'))
except ImportError:
pass # cheatlib was not installed
paths.extend(os.environ.get('CHEATPATH', '').split(os.pathsep))
return [path for path in paths if os.path.isdir(path)]

0
cheatlib/__init__.py Normal file
View File

View File

@ -9,8 +9,7 @@ setup(name='cheat',
author='Chris Lane',
author_email='chris@chris-allen-lane.com',
url='https://github.com/chrisallenlane/cheat',
packages=['cheatsheets'],
package_data={'cheatsheets': [f for f in os.listdir('cheatsheets')
if '.' not in f]},
scripts=['cheat']
packages=['cheatlib'],
package_data={'cheatlib': ['cheatsheets/*']},
scripts=['cheat'],
)