diff --git a/pisi/actionsapi/pisitools.py b/pisi/actionsapi/pisitools.py new file mode 100644 index 00000000..afa40905 --- /dev/null +++ b/pisi/actionsapi/pisitools.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import os, shutil + +def dodoc(*documentList): + install_dir = os.getenv('INSTALL_DIR') + src_name = os.getenv('SRC_NAME') + src_version = os.getenv('SRC_VERSION') + src_release = os.getenv('SRC_RELEASE') + + srcTag = src_name + '-' + src_version + '-' + src_release + + # FIXME: Exception yiyoruz eğer klasör mevcutsa, adam edilecek! + os.makedirs(install_dir + '/' + 'usr/share/doc/' + srcTag) + + for document in documentList: + if os.access(document, os.F_OK): + shutil.copyfile(document, os.path.join(install_dir, \ + 'usr/share/doc/' + srcTag + '/' + os.path.basename(document))) + \ No newline at end of file diff --git a/pisi/build.py b/pisi/build.py index 9408bd60..01efb65a 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -56,24 +56,17 @@ class PisiBuild: curDir = os.getcwd() locals = globals = {} - # put the evironment variables for actions API to use. - evn = { - "PKG_DIR": self.ctx.pkg_dir(), - "WORK_DIR": self.ctx.pkg_work_dir(), - "INSTALL_DIR": self.ctx.pkg_install_dir(), - "SRC_NAME": self.spec.source.name, - "SRC_VERSION": self.spec.source.version - } - os.environ.update(evn) try: exec compile(self.actionScript , "error", "exec") in locals,globals except SyntaxError, e: ui.error ("Error : %s\n" % e) return - - self.goToWorkDir(globals) - + # Go to source directory + self.gotoSrcDir(globals) + # Set needed evironment variables for actions API + self.setEnvorinment() + # Run configure, build and install phase self.configureSource(locals) self.buildSource(locals) self.installSource(locals) @@ -89,7 +82,19 @@ class PisiBuild: def applyPatches(self): pass - def goToWorkDir(self, globals): + def setEnvorinment(self): + # put the evironment variables for actions API to use. + evn = { + "PKG_DIR": self.ctx.pkg_dir(), + "WORK_DIR": self.ctx.pkg_work_dir(), + "INSTALL_DIR": self.ctx.pkg_install_dir(), + "SRC_NAME": self.spec.source.name, + "SRC_VERSION": self.spec.source.version, + "SRC_RELEASE": self.spec.source.release + } + os.environ.update(evn) + + def gotoSrcDir(self, globals): """Changes the current working directory to package_work_dir() for actions.py to do its work.""" if 'WorkDir' in globals: diff --git a/samples/startup-notification/actions.py b/samples/startup-notification/actions.py index 2bb8c37e..96e8a863 100644 --- a/samples/startup-notification/actions.py +++ b/samples/startup-notification/actions.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- from pisi.actionsapi import autotools +from pisi.actionsapi import pisitools def setup(): autotools.configure() @@ -11,3 +12,4 @@ def build(): def install(): autotools.install() + pisitools.dodoc('AUTHORS','ChangeLog','INSTALL', 'NEWS', 'README', 'doc/startup-notification.txt')