Skip to content

Commit

Permalink
streamline installation
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed May 3, 2012
1 parent 8e76b7a commit ffeb488
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 40 deletions.
17 changes: 7 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ based on the output of Ned Batchelder's
Installation
------------

1. Use git to check out ``SublimePythonCoverage``
into your Sublime Text 2 ``Packages`` directory.
Set up
`Sublime Package Control <http://wbond.net/sublime_packages/package_control>`_
if you don't have it yet.

On OS X::
Go to Tools > Command Palette.
Type ``Package Control: Install Package`` and hit enter.
Type ``SublimePythonCoverage`` and hit enter.
It may take a bit to install as it needs to fetch its dependency, coverage.py.

$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
$ git clone git://github.com/davisagli/SublimePythonCoverage.git

2. Install our dependency, ``coverage.py``::

$ cd SublimePythonCoverage
$ python setup.py install

Usage
-----
Expand Down
31 changes: 29 additions & 2 deletions SublimePythonCoverage.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
# bootstrap
import os
import sublime, sublime_plugin
os.chdir(os.path.dirname(__file__))
if not os.path.exists(os.path.join(os.getcwd(), 'coverage')):
# Fetch coverage.py
print 'SublimePythonCoverage installing coverage.py.'

from coverage import coverage
from StringIO import StringIO
import tarfile
import urllib
from hashlib import md5

SOURCE = 'http://pypi.python.org/packages/source/c/coverage/coverage-3.5.1.tar.gz'
MD5SUM = '410d4c8155a4dab222f2bc51212d4a24'

payload = urllib.urlopen(SOURCE).read()
if md5(payload).hexdigest() != MD5SUM:
raise ImportError('Invalid checksum.')

tar = tarfile.open(mode='r:gz', fileobj=StringIO(payload))
for m in tar.getmembers():
if not m.name.startswith('coverage-3.5.1/coverage/'):
continue
m.name = '/'.join(m.name.split('/')[2:])
tar.extract(m, 'coverage')

print 'SublimePythonCoverage successfully installed coverage.py.'
# end bootstrap


import sublime, sublime_plugin
from coverage import coverage
PLUGIN_FILE = os.path.abspath(__file__)


Expand Down
28 changes: 0 additions & 28 deletions setup.py

This file was deleted.

0 comments on commit ffeb488

Please sign in to comment.