diff options
author | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2011-10-10 12:40:39 -0400 |
---|---|---|
committer | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2011-10-10 14:49:26 -0400 |
commit | 9cfb332b22e38b9d965bfb691eca67b6b8fa64e3 (patch) | |
tree | 6c01ceb39716bacbe3d2a0c756ad3a5adac119f1 /setup.py | |
parent | 86c4cf4ea66e926267f53348d22698774a7939a5 (diff) | |
download | pycrypto-9cfb332b22e38b9d965bfb691eca67b6b8fa64e3.tar.gz |
autoconf: only use side-channel secured mpz_powm_sec if it's available (libgmp 5 or later)
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -38,6 +38,7 @@ __revision__ = "$Id$" from distutils import core from distutils.core import Extension, Command +from distutils.command.build import build from distutils.command.build_ext import build_ext import os, sys import struct @@ -191,6 +192,27 @@ class PCTBuildExt (build_ext): if compiler is not None: compiler.append(option) +class PCTBuild(build): + def has_configure(self): + return sys.platform != 'win32' + + sub_commands = [ ('build_configure', has_configure) ] + build.sub_commands + +class PCTBuildConfigure(Command): + description = "Generate config.h using ./configure (autoconf)" + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + if os.system("chmod 0755 configure") != 0: + raise RuntimeError("chmod error") + if os.system("./configure") != 0: + raise RuntimeError("autoconf error") + class PCTBuildPy(build_py): def find_package_modules(self, package, package_dir, *args, **kwargs): modules = build_py.find_package_modules(self, package, package_dir, *args, **kwargs) @@ -260,7 +282,7 @@ kw = {'name':"pycrypto", 'author_email':"dlitz@dlitz.net", 'url':"http://www.pycrypto.org/", - 'cmdclass' : {'build_ext':PCTBuildExt, 'build_py': PCTBuildPy, 'test': TestCommand }, + 'cmdclass' : {'build': PCTBuild, 'build_configure': PCTBuildConfigure, 'build_ext':PCTBuildExt, 'build_py': PCTBuildPy, 'test': TestCommand }, 'packages' : ["Crypto", "Crypto.Hash", "Crypto.Cipher", "Crypto.Util", "Crypto.Random", "Crypto.Random.Fortuna", |