Skip to content

Commit

Permalink
Add ridiculous setup.py, tweak some generation
Browse files Browse the repository at this point in the history
  • Loading branch information
brendonh committed Feb 17, 2013
1 parent b3102af commit a7c690b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -5,7 +5,7 @@ Synopsis
--------

```bash
pip install markdown mako PyYAML git+git@github.com:brendonh/rantbase.git
pip install markdown mako PyYAML git+git://github.com/brendonh/rantbase.git
mkdir mysite
cd mysite
python -m rantbase init
Expand Down
1 change: 0 additions & 1 deletion rantbase/__main__.py
Expand Up @@ -17,6 +17,5 @@
action='store_const', const=True)
update.set_defaults(func=commands.runUpdate)


args = parser.parse_args()
args.func(args)
12 changes: 8 additions & 4 deletions rantbase/update.py
Expand Up @@ -46,7 +46,11 @@ def update(dir, force=False):
continue

(baseName, ext) = os.path.splitext(webPath)
if ext.lower() == '.md':
ext = ext.lower()

if ext.endswith("~"):
continue
elif ext.lower() == '.md':
collection = markdowns
webPath = "%s.html" % baseName
else:
Expand Down Expand Up @@ -81,12 +85,12 @@ def update(dir, force=False):
for docPath, webPath in markdowns:
print "Markdowning", docPath, "to", webPath

title = os.path.splitext(os.path.basename(docPath))[0].replace('_', ' ').title()
title = os.path.splitext(os.path.basename(docPath))[0].replace('-', ' ').title()

markupFile = codecs.open(docPath, mode="r", encoding="utf-8")

tagLine = markupFile.next().strip()

if tagLine.startswith('#'):
tags = tagRE.findall(tagLine)
webUrl = os.path.relpath(webPath, os.path.join(dir, 'web'))
Expand All @@ -96,7 +100,7 @@ def update(dir, force=False):
markupFile.seek(0)
tags = []

markup = markupFile.read()
markup = u''.join(markupFile)

content = markdown.markdown(markup)
html = template.render_unicode(
Expand Down
34 changes: 34 additions & 0 deletions setup.py
@@ -0,0 +1,34 @@
import os, itertools

from setuptools import setup, find_packages

dataFiles = list(
itertools.chain.from_iterable(
[(fs[0], [fs[0] + '/' + f]) for f in fs[2] if not f.endswith('~')]
for fs in os.walk('rantbase/priv')))

setup(name="rantbase",
version="0.1",

description="Simple markdown document collection",
author="Brendon Hogger",
author_email="brendonh@gmail.com",
url="https://github.com/brendonh/rantbase",
long_description=open('README.md').read(),

download_url="https://github.com/brendonh/rantbase/zipball/master",

packages = find_packages(),
zip_safe = False,

install_requires = [
],

data_files = dataFiles,

# include_package_data = True,
# package_data = {
# '': ['priv/**']
# },

)

0 comments on commit a7c690b

Please sign in to comment.