[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/archivemail/devel archivemail, NONE, 1.1 archivemail-0.7.0-fpname.patch, NONE, 1.1 archivemail-README.tests, NONE, 1.1 archivemail-main-noshebang.patch, NONE, 1.1 archivemail-test-noshebang.patch, NONE, 1.1 archivemail.spec, NONE, 1.1 test_archivemail.patch, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2



Author: limb

Update of /cvs/pkgs/rpms/archivemail/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2355/devel

Modified Files:
	.cvsignore sources 
Added Files:
	archivemail archivemail-0.7.0-fpname.patch 
	archivemail-README.tests archivemail-main-noshebang.patch 
	archivemail-test-noshebang.patch archivemail.spec 
	test_archivemail.patch 
Log Message:
Initial import.



--- NEW FILE archivemail ---
#!/usr/bin/env python
if __name__ == '__main__':
    import sys
    sys.path.insert(0, '/usr/share/archivemail')
    from archivemail import main
    main()

archivemail-0.7.0-fpname.patch:

--- NEW FILE archivemail-0.7.0-fpname.patch ---
--- archivemail	2006-11-03 01:21:22.000000000 +0200
+++ archivemail	2007-05-10 12:04:16.000000000 +0300
@@ -779,7 +779,10 @@
     # the headers have no valid dates -- last resort, try the file timestamp
     # this will not work for mbox mailboxes
     try:
-        file_name = message.fp.name
+        if sys.hexversion >= 0x020500F0:
+            file_name = message.fp._file.name
+        else:
+            file_name = message.fp.name
     except AttributeError:
         # we are looking at a 'mbox' mailbox - argh! 
         # Just return the current time - this will never get archived :(
@@ -788,7 +791,7 @@
     if not os.path.isfile(file_name):
         unexpected_error("mailbox file name '%s' has gone missing" % \
             file_name)    
-    time_message = os.path.getmtime(message.fp.name)
+    time_message = os.path.getmtime(file_name)
     vprint("using valid time found from '%s' last-modification time" % \
         file_name)
     return time_message
@@ -806,7 +809,11 @@
     """
     status = ""
     x_status = ""
-    match = re.search(":2,(.+)$", message.fp.name)
+    if sys.hexversion >= 0x020500F0:
+        fpname = message.fp._file.name
+    else:
+        fpname = message.fp.name
+    match = re.search(":2,(.+)$", fpname)
     if match:
         flags = match.group(1)
         for flag in flags: 
@@ -825,7 +832,7 @@
 
     # files in the maildir 'cur' directory are no longer new,
     # they are the same as messages with 'Status: O' headers in mbox
-    last_dir = os.path.basename(os.path.dirname(message.fp.name))
+    last_dir = os.path.basename(os.path.dirname(fpname))
     if last_dir == "cur":
         status = status + "O" 
 
@@ -881,7 +888,10 @@
         return 1
     file_name = None
     try:
-        file_name = message.fp.name
+        if sys.hexversion >= 0x020500F0:
+            file_name = message.fp._file.name
+        else:
+	    file_name = message.fp.name
     except AttributeError:
         pass
     # maildir mailboxes use the filename suffix to indicate flagged status
@@ -901,7 +911,10 @@
         return 0
     file_name = None
     try:
-        file_name = message.fp.name
+        if sys.hexversion >= 0x020500F0:
+            file_name = message.fp._file.name
+        else:
+            file_name = message.fp.name
     except AttributeError:
         pass
     # maildir mailboxes use the filename suffix to indicate read status
@@ -918,7 +931,10 @@
     file_name = None
     message_size = None
     try:
-        file_name = message.fp.name
+        if sys.hexversion >= 0x020500F0:
+            file_name = message.fp._file.name
+        else:
+            file_name = message.fp.name
     except AttributeError:
         pass
     if file_name:
@@ -1269,7 +1285,11 @@
                     if type == "maildir":
                         add_status_headers(msg)
                     archive.write(msg)
-            if not options.dry_run: delete_queue.append(msg.fp.name) 
+            if sys.hexversion >= 0x020500F0:
+                fpname = msg.fp._file.name
+            else:
+                fpname = msg.fp.name
+            if not options.dry_run: delete_queue.append(fpname) 
         else:
             vprint("decision: retain message")
         msg = original.next()


--- NEW FILE archivemail-README.tests ---
Use the following command to run unit tests:
"python /usr/share/doc/archivemail-0.7.0/test_archivemail.py"

archivemail-main-noshebang.patch:

--- NEW FILE archivemail-main-noshebang.patch ---
--- archivemail	2007-05-24 06:54:08.000000000 -0500
+++ archivemail	2007-05-24 06:54:08.000000000 -0500
@@ -1,4 +1,3 @@
-#! /usr/bin/env python
 ############################################################################
 # Copyright (C) 2002  Paul Rodger <paul paulrodger com>,
 #           (C) 2006  Peter Poeml <poeml suse de>,

archivemail-test-noshebang.patch:

--- NEW FILE archivemail-test-noshebang.patch ---
--- test_archivemail.py	2007-05-24 06:45:58.000000000 -0500
+++ test_archivemail.py	2007-05-24 06:45:58.000000000 -0500
@@ -1,4 +1,3 @@
-#! /usr/bin/env python
 ############################################################################
 # Copyright (C) 2002  Paul Rodger <paul paulrodger com>
 #           (C) 2006  Nikolaus Schulz <microschulz web de>


--- NEW FILE archivemail.spec ---
Name:		archivemail
Version:	0.7.0
Release:	5%{?dist}
Summary:	A tool for archiving and compressing old email in mailboxes

Group:		Applications/Internet
License:	GPL
URL:		http://archivemail.sourceforge.net/
Source0:	http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
# Small wrapper script for launching archivemail
Source1:	archivemail
Source2:	archivemail-README.tests
Patch0:		test_archivemail.patch
Patch1:		archivemail-test-noshebang.patch
Patch2:		archivemail-main-noshebang.patch
Patch3:		archivemail-0.7.0-fpname.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:	noarch

Requires:	python

%description
Archivemail is a tool written in Python for archiving and compressing old
email in mailboxes. It can move messages older than the specified number of
days to a separate mbox format mailbox that is compressed with gzip, or 
optionally just delete old email.

%prep
%setup -q
chmod 0644 test_archivemail.py
# The patch creates the foundation for removing hardcoded dirs...
%patch0 -b .paths
# ...but I then use sed to further modify the files, so that the RPM build system's
# path macros are used properly:
sed -i "s:ARCHIVEMAIL_DATADIR = '\\./':ARCHIVEMAIL_DATADIR = '%{_datadir}/archivemail':" test_archivemail.py
# Again, follow RPM's macros (in case these get redefined, the package can simply
# be rebuilt instead of modified to compensate for it:
sed -i "s:/usr/share/archivemail:%{_datadir}/archivemail:" %{SOURCE1}

%patch1 -p0
%patch2 -p0
%patch3 -p0

%build

%install
rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -D -m 755 -p %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/archivemail
install -D -m 644 -p archivemail $RPM_BUILD_ROOT%{_datadir}/archivemail/archivemail.py
install -D -m 644 -p archivemail.1 $RPM_BUILD_ROOT%{_mandir}/man1/archivemail.1
cp %{SOURCE2} .

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc archivemail.sgml CHANGELOG COPYING FAQ README test_archivemail.py TODO examples archivemail-README.tests
%{_bindir}/archivemail
%{_datadir}/archivemail
%{_mandir}/man1/archivemail.1.gz

%changelog
* Thu May 24 2007 Jon Ciesla <limb jcomserv net> 0.7.0-5
- Applied upstream patch to fix issues with python 2.5.

* Thu May 24 2007 Jon Ciesla <limb jcomserv net> 0.7.0-4
- Removed shebang from test, main scripts.

* Wed May 23 2007 Jon Ciesla <limb jcomserv net> 0.7.0-3
- Added Readme about test script.

* Wed May 23 2007 Francois Aucamp <faucamp csir co za> - 0.7.0-1.1
- Example spec file using distributed file paths for unit tests
  and the archivemail python module
- Added sed scripts to %%prep
- Moved chmod entries from %%build to %%prep, and cleaned them up
- Removed unnecessary %%doc entries
- Removed unnecessary versioned dependencies

* Tue May 22 2007 Jon Ciesla <limb jcomserv net> 0.7.0-1
- Initial packaging.

test_archivemail.patch:

--- NEW FILE test_archivemail.patch ---
--- test_archivemail.py	2006-10-30 22:02:09.000000000 +0200
+++ test_archivemail-mod.py	2007-05-23 15:58:44.000000000 +0200
@@ -30,6 +30,8 @@
 
 """
 
+ARCHIVEMAIL_DATADIR = './'
+
 import sys
 
 def check_python_version(): 
@@ -59,7 +61,9 @@
 import time
 import unittest
 
+
 try:
+    sys.path.insert(0, ARCHIVEMAIL_DATADIR)
     import archivemail
 except ImportError:
     print "The archivemail script needs to be called 'archivemail.py'"
@@ -355,7 +359,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --quiet %s" % self.mbox_name
+                run = "python archivemail.py --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -418,7 +422,7 @@
                 self.mbox_name = make_mbox(messages=3, headers=headers)
                 self.copy_name = tempfile.mkstemp()[1]
                 shutil.copyfile(self.mbox_name, self.copy_name)
-                run = "./archivemail.py -q %s %s" % (option, self.mbox_name)
+                run = "python archivemail.py -q %s %s" % (option, self.mbox_name)
                 self.assertEqual(os.system(run), 0)
                 assert(os.path.exists(self.mbox_name))
                 self.assertEqual(os.path.getsize(self.mbox_name), 0)
@@ -435,7 +439,7 @@
                 self.mbox_name = make_mbox(messages=3, headers=headers)
                 self.copy_name = tempfile.mkstemp()[1]
                 shutil.copyfile(self.mbox_name, self.copy_name)
-                run = "./archivemail.py -q %s %s" % (option, self.mbox_name)
+                run = "python archivemail.py -q %s %s" % (option, self.mbox_name)
                 self.assertEqual(os.system(run), 0)
                 assert(os.path.exists(self.mbox_name))
                 assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
@@ -455,7 +459,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --quiet %s" % self.mbox_name
+                run = "python archivemail.py --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -480,7 +484,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --quiet %s" % self.mbox_name
+                run = "python archivemail.py --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -508,7 +512,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --quiet %s" % self.mbox_name
+                run = "python archivemail.py --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -603,7 +607,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --quiet %s" % self.mbox_name
+                run = "python archivemail.py --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -626,7 +630,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --quiet %s" % self.mbox_name
+                run = "python archivemail.py --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -649,7 +653,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --quiet %s" % self.mbox_name
+                run = "python archivemail.py --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -683,11 +687,11 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system_long":
-                run = "./archivemail.py --preserve-unread --quiet %s" % \
+                run = "python archivemail.py --preserve-unread --quiet %s" % \
                     self.mbox_name
                 self.assertEqual(os.system(run), 0)
             elif execute == "system_short":
-                run = "./archivemail.py -u --quiet %s" % self.mbox_name
+                run = "python archivemail.py -u --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -711,11 +715,11 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system_long":
-                run = "./archivemail.py --preserve-unread --quiet %s" % \
+                run = "python archivemail.py --preserve-unread --quiet %s" % \
                     self.mbox_name
                 self.assertEqual(os.system(run), 0)
             elif execute == "system_short":
-                run = "./archivemail.py -u --quiet %s" % self.mbox_name
+                run = "python archivemail.py -u --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -748,11 +752,11 @@
                 self.copy_name = tempfile.mkstemp()[1]
                 shutil.copyfile(self.mbox_name, self.copy_name)
                 if execute == "system_long":
-                    run = "./archivemail.py --quiet --suffix='%s' %s" % \
+                    run = "python archivemail.py --quiet --suffix='%s' %s" % \
                         (suffix, self.mbox_name)
                     self.assertEqual(os.system(run), 0)
                 elif execute == "system_short":
-                    run = "./archivemail.py --quiet -s'%s' %s" % \
+                    run = "python archivemail.py --quiet -s'%s' %s" % \
                         (suffix, self.mbox_name)
                     self.assertEqual(os.system(run), 0)
                 elif execute == "package":
@@ -799,10 +803,10 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system_long":
-                run = "./archivemail.py --dry-run --quiet %s" % self.mbox_name
+                run = "python archivemail.py --dry-run --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             elif execute == "system_short":
-                run = "./archivemail.py -n --quiet %s" % self.mbox_name
+                run = "python archivemail.py -n --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -835,10 +839,10 @@
                 archivemail.options.days_old_max = 11
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py -d11 --quiet %s" % self.mbox_name
+                run = "python archivemail.py -d11 --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             elif execute == "system_long":
-                run = "./archivemail.py --days=11 --quiet %s" % self.mbox_name
+                run = "python archivemail.py --days=11 --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -863,10 +867,10 @@
                 archivemail.options.days_old_max = 11
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py -d11 --quiet %s" % self.mbox_name
+                run = "python archivemail.py -d11 --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             elif execute == "system_long":
-                run = "./archivemail.py --days=11 --quiet %s" % self.mbox_name
+                run = "python archivemail.py --days=11 --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -904,7 +908,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --delete --quiet %s" % self.mbox_name
+                run = "python archivemail.py --delete --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -926,7 +930,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --delete --quiet %s" % self.mbox_name
+                run = "python archivemail.py --delete --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -946,7 +950,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --delete --quiet %s" % self.mbox_name
+                run = "python archivemail.py --delete --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -980,7 +984,7 @@
                 archivemail.options.include_flagged = 0
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --quiet %s" % self.mbox_name
+                run = "python archivemail.py --quiet %s" % self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
                 sys.exit(1)
@@ -1002,7 +1006,7 @@
                 archivemail.options.include_flagged = 1
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --include-flagged --quiet %s" % \
+                run = "python archivemail.py --include-flagged --quiet %s" % \
                     self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1025,7 +1029,7 @@
                 archivemail.options.include_flagged = 1
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --include-flagged --quiet %s" % \
+                run = "python archivemail.py --include-flagged --quiet %s" % \
                     self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1064,11 +1068,11 @@
                 archivemail.options.output_dir = self.dir_name
                 archivemail.archive(self.mbox_name)
             elif execute == "system_long":
-                run = "./archivemail.py --output-dir=%s --quiet %s" % \
+                run = "python archivemail.py --output-dir=%s --quiet %s" % \
                     (self.dir_name, self.mbox_name)
                 self.assertEqual(os.system(run), 0)
             elif execute == "system_short":
-                run = "./archivemail.py -o%s --quiet %s" % \
+                run = "python archivemail.py -o%s --quiet %s" % \
                     (self.dir_name, self.mbox_name)
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1113,7 +1117,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --no-compress --quiet %s" % \
+                run = "python archivemail.py --no-compress --quiet %s" % \
                     self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1139,7 +1143,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --no-compress --quiet %s" % \
+                run = "python archivemail.py --no-compress --quiet %s" % \
                     self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1165,7 +1169,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --no-compress --quiet %s" % \
+                run = "python archivemail.py --no-compress --quiet %s" % \
                     self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1192,7 +1196,7 @@
             if execute == "package":
                 archivemail.archive(self.mbox_name)
             elif execute == "system":
-                run = "./archivemail.py --no-compress --quiet %s" % \
+                run = "python archivemail.py --no-compress --quiet %s" % \
                     self.mbox_name
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1231,11 +1235,11 @@
                 archivemail.options.min_size = size_arg
                 archivemail.archive(self.mbox_name)
             elif execute == "system_long":
-                run = "./archivemail.py --size=%d --quiet %s" % \
+                run = "python archivemail.py --size=%d --quiet %s" % \
                     (size_arg, self.mbox_name)
                 self.assertEqual(os.system(run), 0)
             elif execute == "system_short":
-                run = "./archivemail.py -S%d --quiet %s" % \
+                run = "python archivemail.py -S%d --quiet %s" % \
                     (size_arg, self.mbox_name)
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1262,11 +1266,11 @@
                 archivemail.options.min_size = size_arg
                 archivemail.archive(self.mbox_name)
             elif execute == "system_long":
-                run = "./archivemail.py --size=%d --quiet %s" % \
+                run = "python archivemail.py --size=%d --quiet %s" % \
                     (size_arg, self.mbox_name)
                 self.assertEqual(os.system(run), 0)
             elif execute == "system_short":
-                run = "./archivemail.py -S%d --quiet %s" % \
+                run = "python archivemail.py -S%d --quiet %s" % \
                     (size_arg, self.mbox_name)
                 self.assertEqual(os.system(run), 0)
             else:
@@ -1299,7 +1303,7 @@
                 if execute == "package":
                     archivemail.archive(self.mbox_name)
                 elif execute == "system":
-                    run = "./archivemail.py --quiet %s" % self.mbox_name
+                    run = "python archivemail.py --quiet %s" % self.mbox_name
                     self.assertEqual(os.system(run), 0)
                 else:
                     sys.exit(1)
@@ -1322,7 +1326,7 @@
                 if execute == "package":
                     archivemail.archive(self.mbox_name)
                 elif execute == "system":
-                    run = "./archivemail.py --quiet %s" % self.mbox_name
+                    run = "python archivemail.py --quiet %s" % self.mbox_name
                     self.assertEqual(os.system(run), 0)
                 else:
                     sys.exit(1)
@@ -1393,5 +1397,7 @@
     return name
 
 
+
 if __name__ == "__main__":
+    os.chdir(ARCHIVEMAIL_DATADIR)
     unittest.main()


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/archivemail/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	24 May 2007 15:10:56 -0000	1.1
+++ .cvsignore	25 May 2007 12:41:27 -0000	1.2
@@ -0,0 +1 @@
+archivemail-0.7.0.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/archivemail/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	24 May 2007 15:10:56 -0000	1.1
+++ sources	25 May 2007 12:41:27 -0000	1.2
@@ -0,0 +1 @@
+087c9707daa6bb5c44cd052b6d71ce88  archivemail-0.7.0.tar.gz


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]