<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) AB Strakt 2001, All rights reserved
# Copyright (C) <NAME> 2008, All rights reserved
#
# @(#) $Id: setup.py,v 1.28 2004/08/10 10:59:01 martin Exp $
#

"""
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 version import __version__

crypto_src = ['src/crypto/crypto.c', 'src/crypto/x509.c',
              'src/crypto/x509name.c', 'src/crypto/pkey.c',
              'src/crypto/x509store.c', 'src/crypto/x509req.c',
              'src/crypto/x509ext.c', 'src/crypto/pkcs7.c',
              'src/crypto/pkcs12.c', 'src/crypto/netscape_spki.c',
              'src/util.c']
crypto_dep = ['src/crypto/crypto.h', 'src/crypto/x509.h',
              'src/crypto/x509name.h', 'src/crypto/pkey.h',
              'src/crypto/x509store.h', 'src/crypto/x509req.h',
              'src/crypto/x509ext.h', 'src/crypto/pkcs7.h',
              'src/crypto/pkcs12.h', 'src/crypto/netscape_spki.h',
              'src/util.h']
rand_src = ['src/rand/rand.c', 'src/util.c']
rand_dep = ['src/util.h']
ssl_src = ['src/ssl/connection.c', 'src/ssl/context.c', 'src/ssl/ssl.c',
           'src/util.c']
ssl_dep = ['src/ssl/connection.h', 'src/ssl/context.h', 'src/ssl/ssl.h',
           'src/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.
            """
            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)
                    childdirs = os.listdir(ssldir)
                    if (not os.path.isdir(os.path.join(ssldir, "lib")) or
                        not os.path.isdir(os.path.join(ssldir, "include"))):
                        msg = "'%s' is not a proper OpenSSL install dir"
                        raise DistutilsFileError(msg % ssldir)
                    self.with_openssl = ssldir
                    return
            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)<commit_msg>Try to ignore things like C:\Program Files\Subversion<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) AB Strakt 2001, All rights reserved
# Copyright (C) <NAME> 2008, All rights reserved
#
# @(#) $Id: setup.py,v 1.28 2004/08/10 10:59:01 martin Exp $
#

"""
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 version import __version__

crypto_src = ['src/crypto/crypto.c', 'src/crypto/x509.c',
              'src/crypto/x509name.c', 'src/crypto/pkey.c',
              'src/crypto/x509store.c', 'src/crypto/x509req.c',
              'src/crypto/x509ext.c', 'src/crypto/pkcs7.c',
              'src/crypto/pkcs12.c', 'src/crypto/netscape_spki.c',
              'src/util.c']
crypto_dep = ['src/crypto/crypto.h', 'src/crypto/x509.h',
              'src/crypto/x509name.h', 'src/crypto/pkey.h',
              'src/crypto/x509store.h', 'src/crypto/x509req.h',
              'src/crypto/x509ext.h', 'src/crypto/pkcs7.h',
              'src/crypto/pkcs12.h', 'src/crypto/netscape_spki.h',
              'src/util.h']
rand_src = ['src/rand/rand.c', 'src/util.c']
rand_dep = ['src/util.h']
ssl_src = ['src/ssl/connection.c', 'src/ssl/context.c', 'src/ssl/ssl.c',
           'src/util.c']
ssl_dep = ['src/ssl/connection.h', 'src/ssl/context.h', 'src/ssl/ssl.h',
           'src/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)
{'fraction_non_alphanumeric': 0.12186464742072882, 'fraction_numerical': 0.017510648367250355, 'mean_word_length': 1.782422646477946, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2025493', 'n_tokens_mistral': 2764, 'n_tokens_neox': 2513, 'n_words': 551}