[pacman-dev] python-2.7 and pacman test-suite

Dan McGee dpmcgee at gmail.com
Tue Sep 28 10:23:02 EDT 2010


On Mon, Sep 27, 2010 at 9:24 PM, Allan McRae <allan at archlinux.org> wrote:
> On 28/09/10 05:00, Rémy Oudompheng wrote:
>>
>> Dan McGee<dpmcgee at gmail.com>  wrote:
>>>
>>> A trivial fix that doesn't work for anything pre-2.7 though, which is bad
>>> news.
>>
>> May I suggest this much less ugly patch ? The idea of recursively
>> adding non-recursively things seems indeed very odd.
>>
>
> diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py
> index 48d79a3..1d55175 100755
> --- a/test/pacman/pmpkg.py
> +++ b/test/pacman/pmpkg.py
> @@ -164,14 +164,8 @@ def makepkg(self, path):
>
>         # Generate package archive
>         tar = tarfile.open(self.path, "w:gz")
> -
> -        # package files
> -        for root, dirs, files in os.walk('.'):
> -            for d in dirs:
> -                tar.add(os.path.join(root, d), recursive=False)
> -            for f in files:
> -                tar.add(os.path.join(root, f))
> -
> +        for i in os.listdir("."):
> +            tar.add(i)
>         tar.close()
>
>         os.chdir(curdir)
>
>
> That looks fine to me...  but then again, I seem to be missing the whole
> point of non-recursively adding directories in the first place.

Xavier, any insight or memory why you did it this way?

commit c465d9e848b19b495259c7021a583c29fba92b44
Author: Chantry Xavier <shiningxc at gmail.com>
Date:   Thu Apr 17 09:02:11 2008 +0200

    pactest : Use tarfile module.


More information about the pacman-dev mailing list