summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@twistedmatrix.com>2013-12-31 20:16:13 -0500
committerJean-Paul Calderone <exarkun@twistedmatrix.com>2013-12-31 20:16:13 -0500
commit1ac2c1978fe90766a15522bdf5489fc098c8a6d7 (patch)
treee57763b79d810f293d5601df7800dc2b2b31ee8c
parent97336662262a6dc4fabca004e54c52b8f46a8e6b (diff)
downloadpyopenssl-1ac2c1978fe90766a15522bdf5489fc098c8a6d7.tar.gz
Update distutils glue to reflect the extensive changes
-rwxr-xr-xsetup.py199
1 files changed, 11 insertions, 188 deletions
diff --git a/setup.py b/setup.py
index 35ec8f1..09d1723 100755
--- a/setup.py
+++ b/setup.py
@@ -1,214 +1,38 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) AB Strakt 2001, All rights reserved
-# Copyright (C) Jean-Paul Calderone 2008-2010, All rights reserved
+# Copyright (C) Jean-Paul Calderone 2008-2014, All rights reserved
#
"""
Installation script for the OpenSSL module
"""
-import sys, os
-from distutils.core import Extension, setup
-from distutils.errors import DistutilsFileError
-from distutils.command.build_ext import build_ext
+from distutils.core import setup
# XXX Deduplicate this
__version__ = '0.13'
-xcrypto_src = ['OpenSSL/crypto/crypto.c', 'OpenSSL/crypto/x509.c',
- 'OpenSSL/crypto/x509name.c', 'OpenSSL/crypto/pkey.c',
- 'OpenSSL/crypto/x509store.c', 'OpenSSL/crypto/x509req.c',
- 'OpenSSL/crypto/x509ext.c', 'OpenSSL/crypto/pkcs7.c',
- 'OpenSSL/crypto/pkcs12.c', 'OpenSSL/crypto/netscape_spki.c',
- 'OpenSSL/crypto/revoked.c', 'OpenSSL/crypto/crl.c',
- 'OpenSSL/util.c']
-xcrypto_dep = ['OpenSSL/crypto/crypto.h', 'OpenSSL/crypto/x509.h',
- 'OpenSSL/crypto/x509name.h', 'OpenSSL/crypto/pkey.h',
- 'OpenSSL/crypto/x509store.h', 'OpenSSL/crypto/x509req.h',
- 'OpenSSL/crypto/x509ext.h', 'OpenSSL/crypto/pkcs7.h',
- 'OpenSSL/crypto/pkcs12.h', 'OpenSSL/crypto/netscape_spki.h',
- 'OpenSSL/crypto/revoked.h', 'OpenSSL/crypto/crl.h',
- 'OpenSSL/util.h']
-xssl_src = ['OpenSSL/ssl/connection.c', 'OpenSSL/ssl/context.c', 'OpenSSL/ssl/ssl.c',
- 'OpenSSL/ssl/session.c', 'OpenSSL/util.c']
-xssl_dep = ['OpenSSL/ssl/connection.h', 'OpenSSL/ssl/context.h', 'OpenSSL/ssl/ssl.h',
- 'OpenSSL/ssl/session.h', 'OpenSSL/util.h']
-
-IncludeDirs = None
-LibraryDirs = None
-
-# Add more platforms here when needed
-if os.name == 'nt' or sys.platform == 'win32':
-
- Libraries = ['Ws2_32']
-
-
-
- class BuildExtension(build_ext):
- """
- A custom command that semiautomatically finds dependencies required by
- PyOpenSSL.
- """
-
- user_options = (build_ext.user_options +
- [("with-openssl=", None,
- "directory where OpenSSL is installed")])
- with_openssl = None
- openssl_dlls = ()
- openssl_mingw = False
-
-
- def finalize_options(self):
- """
- Update build options with details about OpenSSL.
- """
- build_ext.finalize_options(self)
- if self.with_openssl is None:
- self.find_openssl()
- self.find_openssl_dlls()
- self.add_openssl_compile_info()
-
-
- def find_openssl(self):
- """
- Find OpenSSL's install directory.
- """
- potentials = []
- dirs = os.environ.get("PATH").split(os.pathsep)
- for d in dirs:
- if os.path.exists(os.path.join(d, "openssl.exe")):
- ssldir, bin = os.path.split(d)
- if not bin:
- ssldir, bin = os.path.split(ssldir)
- potentials.append(ssldir)
- childdirs = os.listdir(ssldir)
- if "lib" in childdirs and "include" in childdirs:
- self.with_openssl = ssldir
- return
- if potentials:
- raise DistutilsFileError(
- "Only found improper OpenSSL directories: %r" % (
- potentials,))
- else:
- raise DistutilsFileError("Could not find 'openssl.exe'")
-
-
- def find_openssl_dlls(self):
- """
- Find OpenSSL's shared libraries.
- """
- self.openssl_dlls = []
- self.find_openssl_dll("libssl32.dll", False)
- if self.openssl_dlls:
- self.openssl_mingw = True
- else:
- self.find_openssl_dll("ssleay32.dll", True)
- self.find_openssl_dll("libeay32.dll", True)
- # add zlib to the mix if it looks like OpenSSL
- # was linked with a private copy of it
- self.find_openssl_dll("zlib1.dll", False)
-
-
- def find_openssl_dll(self, name, required):
- """
- Find OpenSSL's shared library and its path after installation.
- """
- dllpath = os.path.join(self.with_openssl, "bin", name)
- if not os.path.exists(dllpath):
- if required:
- raise DistutilsFileError("could not find '%s'" % name)
- else:
- return
- newpath = os.path.join(self.build_lib, "OpenSSL", name)
- self.openssl_dlls.append((dllpath, newpath))
-
-
- def add_openssl_compile_info(self):
- """
- Set up various compile and link parameters.
- """
- if self.compiler == "mingw32":
- if self.openssl_mingw:
- # Library path and library names are sane when OpenSSL is
- # built with MinGW .
- libdir = "lib"
- libs = ["eay32", "ssl32"]
- else:
- libdir = ""
- libs = []
- # Unlike when using the binary installer, which creates
- # an atypical shared library name 'ssleay32', so we have
- # to use this workaround.
- if self.link_objects is None:
- self.link_objects = []
- for dllpath, _ in self.openssl_dlls:
- dllname = os.path.basename(dllpath)
- libname = os.path.splitext(dllname)[0] + ".a"
- libpath = os.path.join(self.with_openssl,
- "lib", "MinGW", libname)
- self.link_objects.append(libpath)
- else:
- libdir = "lib"
- libs = ["libeay32", "ssleay32"]
- self.include_dirs.append(os.path.join(self.with_openssl, "include"))
- self.library_dirs.append(os.path.join(self.with_openssl, libdir))
- self.libraries.extend(libs)
-
-
- def run(self):
- """
- Build extension modules and copy shared libraries.
- """
- build_ext.run(self)
- for dllpath, newpath in self.openssl_dlls:
- self.copy_file(dllpath, newpath)
-
-
- def get_outputs(self):
- """
- Return a list of file paths built by this comand.
- """
- output = [pathpair[1] for pathpair in self.openssl_dlls]
- output.extend(build_ext.get_outputs(self))
- return output
-
-
-
-else:
- Libraries = ['ssl', 'crypto']
- BuildExtension = build_ext
-
-
-
-def mkExtension(name):
- modname = 'OpenSSL.' + name
- src = globals()[name.lower() + '_src']
- dep = globals()[name.lower() + '_dep']
- return Extension(modname, src, libraries=Libraries, depends=dep,
- include_dirs=IncludeDirs, library_dirs=LibraryDirs)
-
-
setup(name='pyOpenSSL', version=__version__,
packages = ['OpenSSL'],
package_dir = {'OpenSSL': 'OpenSSL'},
- ext_modules = [mkExtension('xcrypto'), mkExtension('xSSL')],
- py_modules = ['OpenSSL.__init__', 'OpenSSL.tsafe',
+ py_modules = ['OpenSSL.__init__',
+ 'OpenSSL.tsafe',
'OpenSSL.rand',
- 'OpenSSL.version', 'OpenSSL.test.__init__',
+ 'OpenSSL.crypto',
+ 'OpenSSL.SSL',
+ 'OpenSSL.version',
+ 'OpenSSL.test.__init__',
'OpenSSL.test.util',
'OpenSSL.test.test_crypto',
'OpenSSL.test.test_rand',
'OpenSSL.test.test_ssl'],
- zip_safe = False,
- cmdclass = {"build_ext": BuildExtension},
description = 'Python wrapper module around the OpenSSL library',
- author = 'Martin Sjögren, AB Strakt',
- author_email = 'msjogren@gmail.com',
+ author = 'Jean-Paul Calderone',
+ author_email = 'exarkun@twistedmatrix.com',
maintainer = 'Jean-Paul Calderone',
maintainer_email = 'exarkun@twistedmatrix.com',
- url = 'http://pyopenssl.sourceforge.net/',
+ url = 'https://launchpad.net/pyopenssl',
license = 'APL2',
long_description = """\
High-level wrapper around a subset of the OpenSSL library, includes
@@ -224,7 +48,6 @@ High-level wrapper around a subset of the OpenSSL library, includes
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
- 'Programming Language :: C',
'Programming Language :: Python :: 2.4',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',