Skip to content

Commit

Permalink
Document supported modules/functions/classes on the website
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-sans-paille committed Feb 8, 2015
1 parent 4df4d97 commit e599c74
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pythran/intrinsic.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ def __init__(self, d, *args, **kwargs):
def __getitem__(self, key):
return self.fields[key]

def __iter__(self):
return self.fields.__iter__()

def __contains__(self, key):
""" Forward key content to aliased module. """
return key in self.fields
Expand Down
6 changes: 5 additions & 1 deletion website/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ZIP=zip
CP=cp
LN_S=ln -s

PAGES=MANUAL CLI DEVGUIDE TUTORIAL INTERNAL LICENSE AUTHORS TODO Changelog
PAGES=MANUAL CLI SUPPORT DEVGUIDE TUTORIAL INTERNAL LICENSE AUTHORS TODO Changelog

all:index.rst $(patsubst %, %.rst, $(PAGES)) pythran.png
PYTHONPATH=..:$$PYTHONPATH sphinx-build . $(TARGET)
Expand Down Expand Up @@ -44,6 +44,10 @@ AUTHORS.rst:../AUTHORS
TODO.rst:../TODO
$(LN_S) $< $@

SUPPORT.rst:support.py ../pythran/tables.py
./$< > $@


Changelog.rst:../Changelog
echo "=========\nChangelog\n=========\n\n" > $@
cat $< >> $@
Expand Down
45 changes: 45 additions & 0 deletions website/support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python
from pythran import tables

TITLE = "Supported Modules and Functions"

DEPTHS = '=*-+:~#.^"`'

print(DEPTHS[0]*len(TITLE))

This comment has been minimized.

Copy link
@pbrunet

pbrunet Feb 9, 2015

Collaborator

pep8? :)

This comment has been minimized.

Copy link
@pbrunet

pbrunet Feb 9, 2015

Collaborator

BTW, PyMode for vim is good :-) Of course you have to customize it to make it better but still....

print(TITLE)
print(DEPTHS[0]*len(TITLE))
print("")


def format_name(name):
if name.endswith('_') and not name.startswith('_'):
name = name[:-1]
return name


def isiterable(obj):
return hasattr(obj, '__iter__')


def dump_entry(entry_name, entry_value, depth):
if isiterable(entry_value):
print(entry_name)
print(DEPTHS[depth] * len(entry_name))
print("")
sym_entries, sub_entries = [], []
for sym in entry_value:
w = sub_entries if isiterable(entry_value[sym]) else sym_entries
w.append(sym)
for k in sorted(sym_entries):
dump_entry(format_name(k), entry_value[k], depth + 1)
print("")
for k in sorted(sub_entries):
dump_entry(format_name(k), entry_value[k], depth + 1)
print("")
else:
print(entry_name)


for MODULE in sorted(tables.MODULES):
if MODULE != '__dispatch__':
dump_entry(format_name(MODULE), tables.MODULES[MODULE], 1)

0 comments on commit e599c74

Please sign in to comment.