From 12382700b221a1e29d539e36c241188d649885d6 Mon Sep 17 00:00:00 2001 From: "Yaakov M. Nemoy" Date: Fri, 16 Jan 2009 16:54:57 -0500 Subject: Two for one: removes args on getting source dir, turns it to a property, and puts the sourceball inside the packagesource dir. I mean three for one, and snappy red uniforms. Damn! --- modules/darcs.py | 9 +-------- modules/packagesource.py | 14 ++++++++++---- modules/sourceball.py | 13 ++++++------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/modules/darcs.py b/modules/darcs.py index ac1f013..5e3b352 100644 --- a/modules/darcs.py +++ b/modules/darcs.py @@ -95,14 +95,6 @@ class Darcs(RevisionControl): ''' return self.cfg['hackage_name'] - def source(self, *args): - '''the name of the directory where the source is being kept currently - - hackage_name is the canonical name of the package, this is - just for handling branching and other nasty devilish tricks - ''' - return self.cfg['source'] - @contextmanager def src_dir(self, *args): '''executes a code block inside a specific branch and or checkout @@ -231,6 +223,7 @@ class Darcs(RevisionControl): % full_name) p.communicate() sourceball = full_name + '.tar.gz' + with pwd(self.branch_dir) move(join(self.source_dir(), sourceball), sourceball) self.cfg['sourceball'] = sourceball diff --git a/modules/packagesource.py b/modules/packagesource.py index 874483c..389af27 100644 --- a/modules/packagesource.py +++ b/modules/packagesource.py @@ -62,9 +62,15 @@ class PackageSource(Directory): def setup_sourceball_w_patches(self): raise NotImplementedError - def source(self, *args): - raise NotImplementedError + @property + def source(self): + '''the name of the directory where the source is being kept currently + ''' + return self.cfg['source'] - def source_dir(self, *args): - return join(self.dir, self.source(*args)) + @property + def source_dir(self): + '''the absolute pathname of the directory where the source is being kept currently + ''' + return join(self.dir, self.source) diff --git a/modules/sourceball.py b/modules/sourceball.py index a84a110..07a29e5 100644 --- a/modules/sourceball.py +++ b/modules/sourceball.py @@ -53,7 +53,7 @@ class SourceBall(PackageSource): with pwd(self.branch_dir): sourceball.extractall() move(self.name, self.orig_dir(self.name)) - with pwd(self.parent): + with pwd(self.pkg_src_dir): move(join(tmp_dir, sourceball_name), sourceball_name) self.cfg['sourceball'] = sourceball_name @@ -63,16 +63,15 @@ class SourceBall(PackageSource): use for making patches against modified source''' return dir + '_orig' - def source(self, *args): + def set_cur_to(self, *args): '''gives source directory first parameter, if 'orig' gives the original source, otherwise you get the modified source ''' - if args[0] == 'orig': - return join(self.branch, self.orig_dir(self.name)) - else: - return self.name - + if len(args) == 1 and args[0] == 'head': + self.cfg['source'] = '.' + elif len(args) == 1 and args[0] == 'orig': + self.cfg['source'] = join(self.branch, self.orig_dir(self.name)) __all__ = ['SourceBall'] -- cgit