summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Weller <ianweller@gmail.com>2008-10-04 20:53:52 -0500
committerIan Weller <ianweller@gmail.com>2008-10-04 20:53:52 -0500
commitf980afa1039381177e091850bf128b59d2b78b32 (patch)
tree010be0f78d7523688e383b3d44bbb343cb4f272c
parent28ab4bdec66a2a3c4bdb04c28933a0e3a72fdf90 (diff)
downloadfedora-business-cards-f980afa1039381177e091850bf128b59d2b78b32.zip
fedora-business-cards-f980afa1039381177e091850bf128b59d2b78b32.tar.gz
fedora-business-cards-f980afa1039381177e091850bf128b59d2b78b32.tar.xz
Add pavement for paver
-rw-r--r--pavement.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/pavement.py b/pavement.py
new file mode 100644
index 0000000..40316c1
--- /dev/null
+++ b/pavement.py
@@ -0,0 +1,48 @@
+from glob import glob
+import iniparse
+import os
+import paver.path
+
+options(
+ setup=Bunch(
+ name="fedora-business-cards",
+ version="0.2",
+ description="A generator for Fedora contributor business cards",
+ packages=["fedora_business_cards"],
+ author="Ian Weller",
+ author_email="ianweller@gmail.com",
+ license="GPLv2+",
+ url="https://fedoraproject.org/wiki/Business_cards"
+ ),
+ install_templates=Bunch(
+ templates=glob("templates/*"),
+ data_dir="/usr/share/fedora-business-cards"
+ )
+)
+
+
+@task
+@cmdopts([('root=', 'r', 'install everything relative to this alternative root'
+ ' directory')])
+def install_templates():
+ """install necessary templates for generator"""
+ options.order("install_templates", add_rest=True)
+ try:
+ root_dir = options.root
+ except AttributeError:
+ root_dir = ''
+ parser = iniparse.ConfigParser()
+ parser.read("config.ini")
+ templates_dir = options.data_dir + "/templates"
+ parser.set("location", "templates", templates_dir)
+ data_dir = paver.path.path(root_dir + options.data_dir)
+ if not os.path.exists(data_dir):
+ data_dir.makedirs(0755)
+ parser.write(file(root_dir + options.data_dir + "/config.ini", "w"))
+ for template_file in options.templates:
+ templates_dir = paver.path.path(root_dir + options.data_dir +
+ "/templates")
+ if not os.path.exists(templates_dir):
+ templates_dir.makedirs(0755)
+ command = "install -p %s %s" % (template_file, templates_dir)
+ dry(command, paver.runtime.sh, [command])