~ubuntu-branches/ubuntu/maverick/pygame/maverick

« back to all changes in this revision

Viewing changes to docs/__main__.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-14 17:02:11 UTC
  • mfrom: (1.3.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100114170211-21eop2ja7mr9vdcr
Tags: 1.9.1release-0ubuntu1
* New upstream version (lp: #433304)
* debian/control:
  - build-depends on libportmidi-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# python -m pygame.docs
 
2
 
 
3
import os
 
4
import webbrowser
 
5
try:
 
6
    from urllib.parse import urlunparse, quote
 
7
except ImportError:
 
8
    from urlparse import urlunparse
 
9
    from urllib import quote
 
10
 
 
11
def iterpath(path):
 
12
    path, last = os.path.split(path)
 
13
    if last:
 
14
        for p in iterpath(path):
 
15
            yield p
 
16
        yield last
 
17
 
 
18
pkg_dir = os.path.dirname(os.path.abspath(__file__))
 
19
main_page = os.path.join(pkg_dir, 'index.html')
 
20
url_path = quote('/'.join(iterpath(main_page)))
 
21
url = urlunparse(('file', '', url_path, '', '', ''))
 
22
webbrowser.open(url)