summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author?ric Araujo <merwok@netwok.org>2012-03-13 16:05:55 +0100
committer?ric Araujo <merwok@netwok.org>2012-03-13 16:05:55 +0100
commit030489ab11c4252a876d1881e2c7a9b38c07a898 (patch)
treefc7c2417d4ae7058a3fc35121df72ea3edcca599
parent7d29edff4202035cc03f339e1a90ea30db37d640 (diff)
downloaddisutils2-030489ab11c4252a876d1881e2c7a9b38c07a898.tar.gz
Add missing CHANGES entries and remove more 2.4 support code
-rw-r--r--CHANGES.txt4
-rw-r--r--DEVNOTES.txt8
-rw-r--r--PC/build_ssl.py282
-rw-r--r--README.txt2
-rw-r--r--setup.cfg5
-rw-r--r--setup.py135
-rwxr-xr-xtests.sh10
-rw-r--r--tox.ini9
8 files changed, 25 insertions, 430 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 112d597..93ba837 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -169,6 +169,10 @@ CONTRIBUTORS.txt for full names. Bug numbers refer to http://bugs.python.org/.
- #13974: add test for util.set_platform [tshepang]
- #6884: Fix MANIFEST.in parsing bugs on Windows [éric, nadeem]
- #11841: Fix comparison bug with 'rc' versions [filip]
+- #14263: Fix function name lookup in d2.pypi.wrapper [tarek]
+- #14264: Stop removing trailing zeroes in versions [tarek]
+- #14268: Fix small error in a test [tarek]
+- Drop support for Python 2.4 [tarek, éric]
1.0a3 - 2010-10-08
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index 54d3476..1f5a5f2 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -11,7 +11,7 @@ Notes for Developers
Repo: http://hg.python.org/cpython (default branch)
More info: http://wiki.python.org/moin/Distutils/Contributing
-- Distutils2 runs on Python from 2.4 to 2.7, so make sure you don't use code
+- Distutils2 runs on Python from 2.5 to 2.7, so make sure you don't use code
that doesn't work under one of these Python versions. The version in the
"python3" branch is compatible with all version from 3.1 to 3.3.
@@ -21,12 +21,8 @@ Notes for Developers
have a look or use a diff tool with the same file in distutils or packaging
from Python 3.3. If you can't run tests, let someone else do the merge.
-- For 2.4, you need to run "python2.4 setup.py build" before you can try out
- pysetup or run tests (unless you use the runtests.py script which will call
- "setup.py build" automatically).
-
- Always run tests.sh before you commit a change. This implies that you have
- all Python versions installed from 2.4 to 2.7, as well as 3.1-.3.3 if you
+ all Python versions installed from 2.5 to 2.7, as well as 3.1-.3.3 if you
merge into the python3 branch. Be sure to also have docutils installed on all
Python versions to avoid skipping tests.
diff --git a/PC/build_ssl.py b/PC/build_ssl.py
deleted file mode 100644
index eff2938..0000000
--- a/PC/build_ssl.py
+++ /dev/null
@@ -1,282 +0,0 @@
-# Script for building the _ssl and _hashlib modules for Windows.
-# Uses Perl to setup the OpenSSL environment correctly
-# and build OpenSSL, then invokes a simple nmake session
-# for the actual _ssl.pyd and _hashlib.pyd DLLs.
-
-# THEORETICALLY, you can:
-# * Unpack the latest SSL release one level above your main Python source
-# directory. It is likely you will already find the zlib library and
-# any other external packages there.
-# * Install ActivePerl and ensure it is somewhere on your path.
-# * Run this script from the PCBuild directory.
-#
-# it should configure and build SSL, then build the _ssl and _hashlib
-# Python extensions without intervention.
-
-# Modified by Christian Heimes
-# Now this script supports pre-generated makefiles and assembly files.
-# Developers don't need an installation of Perl anymore to build Python. A svn
-# checkout from our svn repository is enough.
-#
-# In Order to create the files in the case of an update you still need Perl.
-# Run build_ssl in this order:
-# python.exe build_ssl.py Release x64
-# python.exe build_ssl.py Release Win32
-
-import os, sys, re, shutil
-
-# Find all "foo.exe" files on the PATH.
-def find_all_on_path(filename, extras = None):
- entries = os.environ["PATH"].split(os.pathsep)
- ret = []
- for p in entries:
- fname = os.path.abspath(os.path.join(p, filename))
- if os.path.isfile(fname) and fname not in ret:
- ret.append(fname)
- if extras:
- for p in extras:
- fname = os.path.abspath(os.path.join(p, filename))
- if os.path.isfile(fname) and fname not in ret:
- ret.append(fname)
- return ret
-
-# Find a suitable Perl installation for OpenSSL.
-# cygwin perl does *not* work. ActivePerl does.
-# Being a Perl dummy, the simplest way I can check is if the "Win32" package
-# is available.
-def find_working_perl(perls):
- for perl in perls:
- fh = os.popen('"%s" -e "use Win32;"' % perl)
- fh.read()
- rc = fh.close()
- if rc:
- continue
- return perl
- print("Can not find a suitable PERL:")
- if perls:
- print(" the following perl interpreters were found:")
- for p in perls:
- print(" ", p)
- print(" None of these versions appear suitable for building OpenSSL")
- else:
- print(" NO perl interpreters were found on this machine at all!")
- print(" Please install ActivePerl and ensure it appears on your path")
- return None
-
-# Locate the best SSL directory given a few roots to look into.
-def find_best_ssl_dir(sources):
- candidates = []
- for s in sources:
- try:
- # note: do not abspath s; the build will fail if any
- # higher up directory name has spaces in it.
- fnames = os.listdir(s)
- except os.error:
- fnames = []
- for fname in fnames:
- fqn = os.path.join(s, fname)
- if os.path.isdir(fqn) and fname.startswith("openssl-"):
- candidates.append(fqn)
- # Now we have all the candidates, locate the best.
- best_parts = []
- best_name = None
- for c in candidates:
- parts = re.split("[.-]", os.path.basename(c))[1:]
- # eg - openssl-0.9.7-beta1 - ignore all "beta" or any other qualifiers
- if len(parts) >= 4:
- continue
- if parts > best_parts:
- best_parts = parts
- best_name = c
- if best_name is not None:
- print("Found an SSL directory at '%s'" % (best_name,))
- else:
- print("Could not find an SSL directory in '%s'" % (sources,))
- sys.stdout.flush()
- return best_name
-
-def create_makefile64(makefile, m32):
- """Create and fix makefile for 64bit
-
- Replace 32 with 64bit directories
- """
- if not os.path.isfile(m32):
- return
- with open(m32) as fin:
- with open(makefile, 'w') as fout:
- for line in fin:
- line = line.replace("=tmp32", "=tmp64")
- line = line.replace("=out32", "=out64")
- line = line.replace("=inc32", "=inc64")
- # force 64 bit machine
- line = line.replace("MKLIB=lib", "MKLIB=lib /MACHINE:X64")
- line = line.replace("LFLAGS=", "LFLAGS=/MACHINE:X64 ")
- # don't link against the lib on 64bit systems
- line = line.replace("bufferoverflowu.lib", "")
- fout.write(line)
- os.unlink(m32)
-
-def fix_makefile(makefile):
- """Fix some stuff in all makefiles
- """
- if not os.path.isfile(makefile):
- return
- with open(makefile) as fin:
- lines = fin.readlines()
- with open(makefile, 'w') as fout:
- for line in lines:
- if line.startswith("PERL="):
- continue
- if line.startswith("CP="):
- line = "CP=copy\n"
- if line.startswith("MKDIR="):
- line = "MKDIR=mkdir\n"
- if line.startswith("CFLAG="):
- line = line.strip()
- for algo in ("RC5", "MDC2", "IDEA"):
- noalgo = " -DOPENSSL_NO_%s" % algo
- if noalgo not in line:
- line = line + noalgo
- line = line + '\n'
- fout.write(line)
-
-def run_configure(configure, do_script):
- print("perl Configure "+configure+" no-idea no-mdc2")
- os.system("perl Configure "+configure+" no-idea no-mdc2")
- print(do_script)
- os.system(do_script)
-
-def cmp(f1, f2):
- bufsize = 1024 * 8
- with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
- while True:
- b1 = fp1.read(bufsize)
- b2 = fp2.read(bufsize)
- if b1 != b2:
- return False
- if not b1:
- return True
-
-def copy(src, dst):
- if os.path.isfile(dst) and cmp(src, dst):
- return
- shutil.copy(src, dst)
-
-def main():
- build_all = "-a" in sys.argv
- # Default to 'Release' configuration on for the 'Win32' platform
- try:
- configuration, platform = sys.argv[1:3]
- except ValueError:
- configuration, platform = 'Release', 'Win32'
- if configuration == "Release":
- debug = False
- elif configuration == "Debug":
- debug = True
- else:
- raise ValueError(str(sys.argv))
-
- if platform == "Win32":
- arch = "x86"
- configure = "VC-WIN32"
- do_script = "ms\\do_nasm"
- makefile="ms\\nt.mak"
- m32 = makefile
- dirsuffix = "32"
- elif platform == "x64":
- arch="amd64"
- configure = "VC-WIN64A"
- do_script = "ms\\do_win64a"
- makefile = "ms\\nt64.mak"
- m32 = makefile.replace('64', '')
- dirsuffix = "64"
- #os.environ["VSEXTCOMP_USECL"] = "MS_OPTERON"
- else:
- raise ValueError(str(sys.argv))
-
- make_flags = ""
- if build_all:
- make_flags = "-a"
- # perl should be on the path, but we also look in "\perl" and "c:\\perl"
- # as "well known" locations
- perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"])
- perl = find_working_perl(perls)
- if perl:
- print("Found a working perl at '%s'" % (perl,))
- else:
- print("No Perl installation was found. Existing Makefiles are used.")
- sys.stdout.flush()
- # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live.
- ssl_dir = find_best_ssl_dir(("..\\..",))
- if ssl_dir is None:
- sys.exit(1)
-
- old_cd = os.getcwd()
- try:
- os.chdir(ssl_dir)
- # rebuild makefile when we do the role over from 32 to 64 build
- if arch == "amd64" and os.path.isfile(m32) and not os.path.isfile(makefile):
- os.unlink(m32)
-
- # If the ssl makefiles do not exist, we invoke Perl to generate them.
- # Due to a bug in this script, the makefile sometimes ended up empty
- # Force a regeneration if it is.
- if not os.path.isfile(makefile) or os.path.getsize(makefile)==0:
- if perl is None:
- print("Perl is required to build the makefiles!")
- sys.exit(1)
-
- print("Creating the makefiles...")
- sys.stdout.flush()
- # Put our working Perl at the front of our path
- os.environ["PATH"] = os.path.dirname(perl) + \
- os.pathsep + \
- os.environ["PATH"]
- run_configure(configure, do_script)
- if debug:
- print("OpenSSL debug builds aren't supported.")
- #if arch=="x86" and debug:
- # # the do_masm script in openssl doesn't generate a debug
- # # build makefile so we generate it here:
- # os.system("perl util\mk1mf.pl debug "+configure+" >"+makefile)
-
- if arch == "amd64":
- create_makefile64(makefile, m32)
- fix_makefile(makefile)
- copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
- copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
-
- # If the assembler files don't exist in tmpXX, copy them there
- if perl is None and os.path.exists("asm"+dirsuffix):
- if not os.path.exists("tmp"+dirsuffix):
- os.mkdir("tmp"+dirsuffix)
- for f in os.listdir("asm"+dirsuffix):
- if not f.endswith(".asm"): continue
- if os.path.isfile(r"tmp%s\%s" % (dirsuffix, f)): continue
- shutil.copy(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix)
-
- # Now run make.
- if arch == "amd64":
- rc = os.system("ml64 -c -Foms\\uptable.obj ms\\uptable.asm")
- if rc:
- print("ml64 assembler has failed.")
- sys.exit(rc)
-
- copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
- copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h")
-
- #makeCommand = "nmake /nologo PERL=\"%s\" -f \"%s\"" %(perl, makefile)
- makeCommand = "nmake /nologo -f \"%s\"" % makefile
- print("Executing ssl makefiles: " + makeCommand)
- sys.stdout.flush()
- rc = os.system(makeCommand)
- if rc:
- print("Executing "+makefile+" failed")
- print(rc)
- sys.exit(rc)
- finally:
- os.chdir(old_cd)
- sys.exit(rc)
-
-if __name__=='__main__':
- main()
diff --git a/README.txt b/README.txt
index 851cb4d..d30326a 100644
--- a/README.txt
+++ b/README.txt
@@ -10,7 +10,7 @@ main audiences:
- Developers of packaging-related tools who need a support library to
build on
-Authors will have to write a :file:`setup.cfg` file and run a few
+Authors will have to write a ``setup.cfg`` file and run a few
commands to package and distribute their code. End users will be able to
search for, install and remove Python projects with the included
``pysetup`` program. Last, developers will be able to reuse classes and
diff --git a/setup.cfg b/setup.cfg
index 827c3df..e55bc41 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -16,6 +16,11 @@ classifier =
License :: OSI Approved :: Python Software Foundation License
Operating System :: OS Independent
Programming Language :: Python
+ Programming Language :: Python :: 2
+ Programming Language :: Python :: 2.5
+ Programming Language :: Python :: 2.6
+ Programming Language :: Python :: 2.7
+ Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development :: Libraries :: Python Modules
Topic :: System :: Archiving :: Packaging
Topic :: System :: Systems Administration
diff --git a/setup.py b/setup.py
index 20b6441..721a34e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,12 +1,7 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
-import os
-import re
-import sys
import codecs
-from distutils import sysconfig
-from distutils.core import setup, Extension
-from distutils.ccompiler import new_compiler
+from distutils.core import setup
from ConfigParser import RawConfigParser
@@ -22,7 +17,7 @@ def split_files(value):
def cfg_to_args(path='setup.cfg'):
- opts_to_args = {
+ opts_to_args = {
'metadata': (
('name', 'name', None),
('version', 'version', None),
@@ -83,131 +78,5 @@ def cfg_to_args(path='setup.cfg'):
kwargs['package_data'] = package_data
return kwargs
-# (from Python's setup.py, in PyBuildExt.detect_modules())
-def prepare_hashlib_extensions():
- """Decide which C extensions to build and create the appropriate
- Extension objects to build them. Return a list of Extensions.
- """
- ssl_libs = None
- ssl_inc_dir = None
- ssl_lib_dirs = []
- ssl_inc_dirs = []
- if os.name == 'posix':
- # (from Python's setup.py, in PyBuildExt.detect_modules())
- # lib_dirs and inc_dirs are used to search for files;
- # if a file is found in one of those directories, it can
- # be assumed that no additional -I,-L directives are needed.
- lib_dirs = []
- inc_dirs = []
- if os.path.normpath(sys.prefix) != '/usr':
- lib_dirs.append(sysconfig.get_config_var('LIBDIR'))
- inc_dirs.append(sysconfig.get_config_var('INCLUDEDIR'))
- # Ensure that /usr/local is always used
- lib_dirs.append('/usr/local/lib')
- inc_dirs.append('/usr/local/include')
- # Add the compiler defaults; this compiler object is only used
- # to locate the OpenSSL files.
- compiler = new_compiler()
- lib_dirs.extend(compiler.library_dirs)
- inc_dirs.extend(compiler.include_dirs)
- # Now the platform defaults
- lib_dirs.extend(['/lib64', '/usr/lib64', '/lib', '/usr/lib'])
- inc_dirs.extend(['/usr/include'])
- # Find the SSL library directory
- ssl_libs = ['ssl', 'crypto']
- ssl_lib = compiler.find_library_file(lib_dirs, 'ssl')
- if ssl_lib is None:
- ssl_lib_dirs = ['/usr/local/ssl/lib', '/usr/contrib/ssl/lib']
- ssl_lib = compiler.find_library_file(ssl_lib_dirs, 'ssl')
- if ssl_lib is not None:
- ssl_lib_dirs.append(os.path.dirname(ssl_lib))
- else:
- ssl_libs = None
- # Locate the SSL headers
- for ssl_inc_dir in inc_dirs + ['/usr/local/ssl/include',
- '/usr/contrib/ssl/include']:
- ssl_h = os.path.join(ssl_inc_dir, 'openssl', 'ssl.h')
- if os.path.exists(ssl_h):
- if ssl_inc_dir not in inc_dirs:
- ssl_inc_dirs.append(ssl_inc_dir)
- break
- elif os.name == 'nt':
- # (from Python's PCbuild/build_ssl.py, in find_best_ssl_dir())
- # Look for SSL 1 level up from here. That is, the same place the
- # other externals for Python core live.
- # note: do not abspath src_dir; the build will fail if any
- # higher up directory name has spaces in it.
- src_dir = '..'
- try:
- fnames = os.listdir(src_dir)
- except OSError:
- fnames = []
- ssl_dir = None
- best_parts = []
- for fname in fnames:
- fqn = os.path.join(src_dir, fname)
- if os.path.isdir(fqn) and fname.startswith("openssl-"):
- # We have a candidate, determine the best
- parts = re.split("[.-]", fname)[1:]
- # Ignore all "beta" or any other qualifiers;
- # eg - openssl-0.9.7-beta1
- if len(parts) < 4 and parts > best_parts:
- best_parts = parts
- ssl_dir = fqn
- if ssl_dir is not None:
- ssl_libs = ['gdi32', 'user32', 'advapi32',
- os.path.join(ssl_dir, 'out32', 'libeay32')]
- ssl_inc_dir = os.path.join(ssl_dir, 'inc32')
- ssl_inc_dirs.append(ssl_inc_dir)
-
- # Find out which version of OpenSSL we have
- openssl_ver = 0
- openssl_ver_re = re.compile(
- '^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' )
- if ssl_inc_dir is not None:
- opensslv_h = os.path.join(ssl_inc_dir, 'openssl', 'opensslv.h')
- try:
- incfile = open(opensslv_h, 'r')
- for line in incfile:
- m = openssl_ver_re.match(line)
- if m:
- openssl_ver = int(m.group(1), 16)
- except IOError:
- e = str(sys.last_value)
- print("IOError while reading %s: %s" % (opensslv_h, e))
-
- # Now we can determine which extension modules need to be built.
- exts = []
- if ssl_libs is not None and openssl_ver >= 0x907000:
- # The _hashlib module wraps optimized implementations
- # of hash functions from the OpenSSL library.
- exts.append(Extension('distutils2._backport._hashlib',
- ['distutils2/_backport/_hashopenssl.c'],
- include_dirs=ssl_inc_dirs,
- library_dirs=ssl_lib_dirs,
- libraries=ssl_libs))
- else:
- # no openssl at all, use our own md5 and sha1
- exts.append(Extension('distutils2._backport._sha',
- ['distutils2/_backport/shamodule.c']))
- exts.append(Extension('distutils2._backport._md5',
- sources=['distutils2/_backport/md5module.c',
- 'distutils2/_backport/md5.c'],
- depends=['distutils2/_backport/md5.h']) )
- # XXX always compile sha256 and sha512 to have a working hashlib (maybe
- # I (merwok) can't compile _ssl and thus _hashlib for 2.4, maybe because of
- # Debian multiarch, even though I set all needed build vars (and can
- # compile _ssl for 2.6 for example)
- if True:
- #if openssl_ver < 0x908000:
- # # OpenSSL doesn't do these until 0.9.8 so we'll bring our own
- exts.append(Extension('distutils2._backport._sha256',
- ['distutils2/_backport/sha256module.c']))
- exts.append(Extension('distutils2._backport._sha512',
- ['distutils2/_backport/sha512module.c']))
- return exts
-
setup_kwargs = cfg_to_args('setup.cfg')
-if sys.version_info[:2] < (2, 5):
- setup_kwargs['ext_modules'] = prepare_hashlib_extensions()
setup(**setup_kwargs)
diff --git a/tests.sh b/tests.sh
index 061b563..06565ae 100755
--- a/tests.sh
+++ b/tests.sh
@@ -1,4 +1,14 @@
#!/bin/sh
+echo -n "Running tests with Python 2.5... "
+python2.5 -Wd runtests.py -q
+if [ $? -ne 0 ];then
+ echo Failed, re-running
+ python2.5 -Wd runtests.py
+ exit $?
+else
+ echo Success
+fi
+
echo -n "Running tests with Python 2.6... "
python2.6 -Wd runtests.py -q
if [ $? -ne 0 ];then
diff --git a/tox.ini b/tox.ini
index a883465..e0826d1 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
#distshare={homedir}/.tox/distshare
-envlist=py24,py25,py26,py26-s,py27
+envlist=py25,py26,py26-s,py27
[tox:hudson]
#distshare={toxworkdir}/distshare
@@ -20,10 +20,3 @@ distribute=False
basepython=python2.7
commands=
nosetests --with-xunit distutils2/tests
-
-[testenv:py24]
-basepython=python2.4
-commands=
- rm -f distutils2/_backport/_hashlib.so
- python setup.py build_ext -f
- nosetests --with-xunit distutils2/tests