From 027354474fa533bb2be78036b6bf8ea25b32cc64 Mon Sep 17 00:00:00 2001 From: Jeffrey Lund Date: Tue, 20 Aug 2013 16:09:39 -0700 Subject: [PATCH] Cheatsheets are now package data for new cheatlib package --- cheat | 6 ++++++ cheatlib/__init__.py | 0 {cheatsheets => cheatlib/cheatsheets}/apt-cache | 0 {cheatsheets => cheatlib/cheatsheets}/asterisk | 0 {cheatsheets => cheatlib/cheatsheets}/bash | 0 {cheatsheets => cheatlib/cheatsheets}/convert | 0 {cheatsheets => cheatlib/cheatsheets}/cut | 0 {cheatsheets => cheatlib/cheatsheets}/dhclient | 0 {cheatsheets => cheatlib/cheatsheets}/find | 0 {cheatsheets => cheatlib/cheatsheets}/git | 0 {cheatsheets => cheatlib/cheatsheets}/ln | 0 {cheatsheets => cheatlib/cheatsheets}/mysqldump | 0 {cheatsheets => cheatlib/cheatsheets}/netstat | 0 {cheatsheets => cheatlib/cheatsheets}/nmap | 0 {cheatsheets => cheatlib/cheatsheets}/notify-send | 0 {cheatsheets => cheatlib/cheatsheets}/openssl | 0 {cheatsheets => cheatlib/cheatsheets}/scp | 0 {cheatsheets => cheatlib/cheatsheets}/sed | 0 {cheatsheets => cheatlib/cheatsheets}/shred | 0 {cheatsheets => cheatlib/cheatsheets}/sockstat | 0 {cheatsheets => cheatlib/cheatsheets}/split | 0 {cheatsheets => cheatlib/cheatsheets}/ssh | 0 {cheatsheets => cheatlib/cheatsheets}/ssh-copy-id | 0 {cheatsheets => cheatlib/cheatsheets}/ssh-keygen | 0 {cheatsheets => cheatlib/cheatsheets}/stdout | 0 {cheatsheets => cheatlib/cheatsheets}/tar | 0 setup.py | 7 +++---- 27 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 cheatlib/__init__.py rename {cheatsheets => cheatlib/cheatsheets}/apt-cache (100%) rename {cheatsheets => cheatlib/cheatsheets}/asterisk (100%) rename {cheatsheets => cheatlib/cheatsheets}/bash (100%) rename {cheatsheets => cheatlib/cheatsheets}/convert (100%) rename {cheatsheets => cheatlib/cheatsheets}/cut (100%) rename {cheatsheets => cheatlib/cheatsheets}/dhclient (100%) rename {cheatsheets => cheatlib/cheatsheets}/find (100%) rename {cheatsheets => cheatlib/cheatsheets}/git (100%) rename {cheatsheets => cheatlib/cheatsheets}/ln (100%) rename {cheatsheets => cheatlib/cheatsheets}/mysqldump (100%) rename {cheatsheets => cheatlib/cheatsheets}/netstat (100%) rename {cheatsheets => cheatlib/cheatsheets}/nmap (100%) rename {cheatsheets => cheatlib/cheatsheets}/notify-send (100%) rename {cheatsheets => cheatlib/cheatsheets}/openssl (100%) rename {cheatsheets => cheatlib/cheatsheets}/scp (100%) rename {cheatsheets => cheatlib/cheatsheets}/sed (100%) rename {cheatsheets => cheatlib/cheatsheets}/shred (100%) rename {cheatsheets => cheatlib/cheatsheets}/sockstat (100%) rename {cheatsheets => cheatlib/cheatsheets}/split (100%) rename {cheatsheets => cheatlib/cheatsheets}/ssh (100%) rename {cheatsheets => cheatlib/cheatsheets}/ssh-copy-id (100%) rename {cheatsheets => cheatlib/cheatsheets}/ssh-keygen (100%) rename {cheatsheets => cheatlib/cheatsheets}/stdout (100%) rename {cheatsheets => cheatlib/cheatsheets}/tar (100%) diff --git a/cheat b/cheat index b6d122b..3e537bb 100755 --- a/cheat +++ b/cheat @@ -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)] diff --git a/cheatlib/__init__.py b/cheatlib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cheatsheets/apt-cache b/cheatlib/cheatsheets/apt-cache similarity index 100% rename from cheatsheets/apt-cache rename to cheatlib/cheatsheets/apt-cache diff --git a/cheatsheets/asterisk b/cheatlib/cheatsheets/asterisk similarity index 100% rename from cheatsheets/asterisk rename to cheatlib/cheatsheets/asterisk diff --git a/cheatsheets/bash b/cheatlib/cheatsheets/bash similarity index 100% rename from cheatsheets/bash rename to cheatlib/cheatsheets/bash diff --git a/cheatsheets/convert b/cheatlib/cheatsheets/convert similarity index 100% rename from cheatsheets/convert rename to cheatlib/cheatsheets/convert diff --git a/cheatsheets/cut b/cheatlib/cheatsheets/cut similarity index 100% rename from cheatsheets/cut rename to cheatlib/cheatsheets/cut diff --git a/cheatsheets/dhclient b/cheatlib/cheatsheets/dhclient similarity index 100% rename from cheatsheets/dhclient rename to cheatlib/cheatsheets/dhclient diff --git a/cheatsheets/find b/cheatlib/cheatsheets/find similarity index 100% rename from cheatsheets/find rename to cheatlib/cheatsheets/find diff --git a/cheatsheets/git b/cheatlib/cheatsheets/git similarity index 100% rename from cheatsheets/git rename to cheatlib/cheatsheets/git diff --git a/cheatsheets/ln b/cheatlib/cheatsheets/ln similarity index 100% rename from cheatsheets/ln rename to cheatlib/cheatsheets/ln diff --git a/cheatsheets/mysqldump b/cheatlib/cheatsheets/mysqldump similarity index 100% rename from cheatsheets/mysqldump rename to cheatlib/cheatsheets/mysqldump diff --git a/cheatsheets/netstat b/cheatlib/cheatsheets/netstat similarity index 100% rename from cheatsheets/netstat rename to cheatlib/cheatsheets/netstat diff --git a/cheatsheets/nmap b/cheatlib/cheatsheets/nmap similarity index 100% rename from cheatsheets/nmap rename to cheatlib/cheatsheets/nmap diff --git a/cheatsheets/notify-send b/cheatlib/cheatsheets/notify-send similarity index 100% rename from cheatsheets/notify-send rename to cheatlib/cheatsheets/notify-send diff --git a/cheatsheets/openssl b/cheatlib/cheatsheets/openssl similarity index 100% rename from cheatsheets/openssl rename to cheatlib/cheatsheets/openssl diff --git a/cheatsheets/scp b/cheatlib/cheatsheets/scp similarity index 100% rename from cheatsheets/scp rename to cheatlib/cheatsheets/scp diff --git a/cheatsheets/sed b/cheatlib/cheatsheets/sed similarity index 100% rename from cheatsheets/sed rename to cheatlib/cheatsheets/sed diff --git a/cheatsheets/shred b/cheatlib/cheatsheets/shred similarity index 100% rename from cheatsheets/shred rename to cheatlib/cheatsheets/shred diff --git a/cheatsheets/sockstat b/cheatlib/cheatsheets/sockstat similarity index 100% rename from cheatsheets/sockstat rename to cheatlib/cheatsheets/sockstat diff --git a/cheatsheets/split b/cheatlib/cheatsheets/split similarity index 100% rename from cheatsheets/split rename to cheatlib/cheatsheets/split diff --git a/cheatsheets/ssh b/cheatlib/cheatsheets/ssh similarity index 100% rename from cheatsheets/ssh rename to cheatlib/cheatsheets/ssh diff --git a/cheatsheets/ssh-copy-id b/cheatlib/cheatsheets/ssh-copy-id similarity index 100% rename from cheatsheets/ssh-copy-id rename to cheatlib/cheatsheets/ssh-copy-id diff --git a/cheatsheets/ssh-keygen b/cheatlib/cheatsheets/ssh-keygen similarity index 100% rename from cheatsheets/ssh-keygen rename to cheatlib/cheatsheets/ssh-keygen diff --git a/cheatsheets/stdout b/cheatlib/cheatsheets/stdout similarity index 100% rename from cheatsheets/stdout rename to cheatlib/cheatsheets/stdout diff --git a/cheatsheets/tar b/cheatlib/cheatsheets/tar similarity index 100% rename from cheatsheets/tar rename to cheatlib/cheatsheets/tar diff --git a/setup.py b/setup.py index af240f9..dd459b0 100644 --- a/setup.py +++ b/setup.py @@ -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'], )