More py3 fixes, switch to setuptools.
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ include COPYING
|
||||
include TODO
|
||||
include NEWS
|
||||
include CREDITS
|
||||
include README
|
||||
include README.md
|
||||
include ChangeLog
|
||||
include MANIFEST.in
|
||||
include testsample.py
|
||||
|
||||
+4
-1
@@ -72,10 +72,13 @@
|
||||
from __future__ import print_function
|
||||
import smtplib
|
||||
import socket
|
||||
try:
|
||||
from email.message import Message
|
||||
except:
|
||||
from email.Message import Message
|
||||
import Milter
|
||||
import Milter.dns as dns
|
||||
import time
|
||||
import dns
|
||||
|
||||
## Send DSN.
|
||||
# Try the published MX names in order, rejecting obviously bogus entries
|
||||
|
||||
+11
-35
@@ -1,5 +1,4 @@
|
||||
Abstract
|
||||
--------
|
||||
# Abstract
|
||||
|
||||
This is a python extension module to enable python scripts to attach to
|
||||
Sendmail's libmilter API, enabling filtering of messages as they arrive.
|
||||
@@ -7,41 +6,21 @@ Since it's a script, you can do anything you want to the message - screen
|
||||
out viruses, collect statistics, add or modify headers, etc. You can, at
|
||||
any point, tell Sendmail to reject, discard, or accept the message.
|
||||
|
||||
Additional python modules provide for navigating and modifying MIME parts, and
|
||||
sending DSNs or doing CBVs.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
# Requirements
|
||||
|
||||
Python milter extension: http://https://pypi.python.org/pypi/pymilter/
|
||||
Python milter extension: https://pypi.python.org/pypi/pymilter/
|
||||
Python: http://www.python.org
|
||||
Sendmail: http://www.sendmail.org
|
||||
|
||||
NB: From Sendmail's libmilter/README:
|
||||
|
||||
libmilter requires pthread support in the operating system. Moreover, it
|
||||
requires that the library functions it uses are thread safe; which is true
|
||||
for the operating systems libmilter has been developed and tested on. On
|
||||
some operating systems this requires special compile time options (e.g.,
|
||||
not just -pthread). libmilter is currently known to work on (modulo problems
|
||||
in the pthread support of some specific versions):
|
||||
|
||||
FreeBSD 3.x, 4.x
|
||||
SunOS 5.x (x >= 5)
|
||||
AIX 4.3.x
|
||||
HP UX 11.x
|
||||
Linux (recent versions/distributions)
|
||||
|
||||
libmilter is currently not supported on:
|
||||
|
||||
IRIX 6.x
|
||||
Ultrix
|
||||
|
||||
Quick Installation
|
||||
------------------
|
||||
# Quick Installation
|
||||
|
||||
1. Build and install Sendmail, enabling libmilter (see libmilter/README).
|
||||
2. Build and install Python, enabling threading.
|
||||
3. Install this module: python setup.py --help
|
||||
4. Add these two lines to sendmail.cf[*]:
|
||||
4. Add these two lines to sendmail.cf[a]:
|
||||
|
||||
O InputMailFilters=pythonfilter
|
||||
Xpythonfilter, S=local:/home/username/pythonsock
|
||||
@@ -54,7 +33,7 @@ some email will be rejected (see the "header" method). Edit and play.
|
||||
See spfmilter.py for a functional SPF milter, or see bms.py for an complex
|
||||
milter used in production.
|
||||
|
||||
[*] This is for a quick test. Your sendmail.cf in most distros will get
|
||||
[a] This is for a quick test. Your sendmail.cf in most distros will get
|
||||
overwritten whenever sendmail.mc is updated. To make a milter permanent,
|
||||
add something like:
|
||||
|
||||
@@ -62,8 +41,7 @@ INPUT_MAIL_FILTER(`pythonfilter', `S=local:/home/username/pythonsock, F=T, T=C:5
|
||||
|
||||
to sendmail.mc instead.
|
||||
|
||||
Not-so-quick Installation
|
||||
-------------------------
|
||||
# Not-so-quick Installation
|
||||
|
||||
First install Sendmail. Make sure you read libmilter/README in the Sendmail
|
||||
source directory, and make sure you enable libmilter before you build. The
|
||||
@@ -109,8 +87,7 @@ _FFR_MILTER for the cf macros. For example,
|
||||
|
||||
m4 -D_FFR_MILTER ../m4/cf.m4 myconfig.mc > myconfig.cf
|
||||
|
||||
IPv6 Notes
|
||||
----------
|
||||
# IPv6 Notes
|
||||
|
||||
The IPv6 protocol is supported if your operation system supports it
|
||||
and if sendmail was compiled with IPv6 support. To determine if your
|
||||
@@ -165,8 +142,7 @@ be determined the hostname will appear similar to the string
|
||||
RFC 2553 for information on interpreting and using the flowinfo and
|
||||
scopeid socket attributes, both of which are integers.
|
||||
|
||||
Authors
|
||||
-------
|
||||
# Authors
|
||||
|
||||
Jim Niemira (urmane@urmane.org) wrote the original C module and some quick
|
||||
and dirty python to use it. Stuart D. Gathman (stuart@gathman.org) took that
|
||||
@@ -1,2 +1,4 @@
|
||||
Test case for Milter/dsn.py
|
||||
|
||||
Lookup exact RFC syntax of real name / email and make
|
||||
Milter.utils.parse_addr() pass all unit tests.
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import os
|
||||
import sys
|
||||
from distutils.core import setup, Extension
|
||||
from setuptools import setup, Extension
|
||||
|
||||
if sys.version < '2.6.5':
|
||||
sys.exit('ERROR: Sorry, python 2.6.5 is required for this module.')
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
# FIXME: on some versions of sendmail, smutil is renamed to sm.
|
||||
# On slackware and debian, leave it out entirely. It depends
|
||||
# on how libmilter was built by the sendmail package.
|
||||
@@ -16,12 +19,7 @@ modules = ["mime"]
|
||||
# NOTE: importing Milter to obtain version fails when milter.so not built
|
||||
setup(name = "pymilter", version = '1.0.5',
|
||||
description="Python interface to sendmail milter API",
|
||||
long_description="""\
|
||||
This is a python extension module to enable python scripts to
|
||||
attach to sendmail's libmilter functionality. Additional python
|
||||
modules provide for navigating and modifying MIME parts, and
|
||||
sending DSNs or doing CBVs.
|
||||
""",
|
||||
long_description=long_description,
|
||||
author="Jim Niemira",
|
||||
author_email="urmane@urmane.org",
|
||||
maintainer="Stuart D. Gathman",
|
||||
|
||||
Reference in New Issue
Block a user