Exemplo n.º 1
0
    def __init__(self,
                 window_size=0,
                 max_memory_size=0,
                 max_open_handles=sys.maxint):
        """initialize the manager with the given parameters.
        :param window_size: if -1, a default window size will be chosen depending on 
            the operating system's architechture. It will internally be quantified to a multiple of the page size
            If 0, the window may have any size, which basically results in mapping the whole file at one
        :param max_memory_size: maximum amount of memory we may map at once before releasing mapped regions.
            If 0, a viable default iwll be set dependning on the system's architecture.
            It is a soft limit that is tried to be kept, but nothing bad happens if we have to overallocate
        :param max_open_handles: if not maxin, limit the amount of open file handles to the given number.
            Otherwise the amount is only limited by the system iteself. If a system or soft limit is hit, 
            the manager will free as many handles as posisble"""
        self._fdict = dict()
        self._window_size = window_size
        self._max_memory_size = max_memory_size
        self._max_handle_count = max_open_handles
        self._memory_size = 0
        self._handle_count = 0

        if window_size < 0:
            coeff = 32
            if is_64_bit():
                coeff = 1024
            #END handle arch
            self._window_size = coeff * self._MB_in_bytes
        # END handle max window size

        if max_memory_size == 0:
            coeff = 512
            if is_64_bit():
                coeff = 8192
            #END handle arch
            self._max_memory_size = coeff * self._MB_in_bytes
Exemplo n.º 2
0
 def __init__(self, window_size = 0, max_memory_size = 0, max_open_handles = sys.maxint):
     """initialize the manager with the given parameters.
     :param window_size: if -1, a default window size will be chosen depending on 
         the operating system's architechture. It will internally be quantified to a multiple of the page size
         If 0, the window may have any size, which basically results in mapping the whole file at one
     :param max_memory_size: maximum amount of memory we may map at once before releasing mapped regions.
         If 0, a viable default iwll be set dependning on the system's architecture.
         It is a soft limit that is tried to be kept, but nothing bad happens if we have to overallocate
     :param max_open_handles: if not maxin, limit the amount of open file handles to the given number.
         Otherwise the amount is only limited by the system iteself. If a system or soft limit is hit, 
         the manager will free as many handles as posisble"""
     self._fdict = dict()
     self._window_size = window_size
     self._max_memory_size = max_memory_size
     self._max_handle_count = max_open_handles
     self._memory_size = 0
     self._handle_count = 0
     
     if window_size < 0:
         coeff = 32
         if is_64_bit():
             coeff = 1024
         #END handle arch
         self._window_size = coeff * self._MB_in_bytes
     # END handle max window size
     
     if max_memory_size == 0:
         coeff = 512
         if is_64_bit():
             coeff = 8192
         #END handle arch
         self._max_memory_size = coeff * self._MB_in_bytes
Exemplo n.º 3
0
def get_url(version):
    if is_from_sources():
        return 'https://github.com/toxygen-project/toxygen/archive/v' + version + '.zip'
    else:
        if platform.system() == 'Windows':
            name = 'toxygen_windows.zip'
        elif util.is_64_bit():
            name = 'toxygen_linux_64.tar.gz'
        else:
            name = 'toxygen_linux.tar.gz'
        return 'https://github.com/toxygen-project/toxygen/releases/download/v{}/{}'.format(version, name)
Exemplo n.º 4
0
def get_url(version):
    if is_from_sources():
        return 'https://github.com/toxygen-project/toxygen/archive/v' + version + '.zip'
    else:
        if platform.system() == 'Windows':
            name = 'toxygen_windows.zip'
        elif util.is_64_bit():
            name = 'toxygen_linux_64.tar.gz'
        else:
            name = 'toxygen_linux.tar.gz'
        return 'https://github.com/toxygen-project/toxygen/releases/download/v{}/{}'.format(
            version, name)
Exemplo n.º 5
0
def configure():
    """Removes unused libs"""
    d = curr_directory() + "/libs/"
    is_64bits = is_64_bit()
    if not is_64bits:
        if os.path.exists(d + "libtox64.dll"):
            os.remove(d + "libtox64.dll")
        if os.path.exists(d + "libsodium64.a"):
            os.remove(d + "libsodium64.a")
    else:
        if os.path.exists(d + "libtox.dll"):
            os.remove(d + "libtox.dll")
        if os.path.exists(d + "libsodium.a"):
            os.remove(d + "libsodium.a")
        try:
            os.rename(d + "libtox64.dll", d + "libtox.dll")
            os.rename(d + "libsodium64.a", d + "libsodium.a")
        except:
            pass
Exemplo n.º 6
0
Arquivo: main.py Projeto: wdbm/toxygen
def configure():
    """Removes unused libs"""
    d = curr_directory() + '/libs/'
    is_64bits = is_64_bit()
    if not is_64bits:
        if os.path.exists(d + 'libtox64.dll'):
            os.remove(d + 'libtox64.dll')
        if os.path.exists(d + 'libsodium64.a'):
            os.remove(d + 'libsodium64.a')
    else:
        if os.path.exists(d + 'libtox.dll'):
            os.remove(d + 'libtox.dll')
        if os.path.exists(d + 'libsodium.a'):
            os.remove(d + 'libsodium.a')
        try:
            os.rename(d + 'libtox64.dll', d + 'libtox.dll')
            os.rename(d + 'libsodium64.a', d + 'libsodium.a')
        except:
            pass
Exemplo n.º 7
0
def configure():
    """Removes unused libs"""
    d = curr_directory() + '/libs/'
    is_64bits = is_64_bit()
    if not is_64bits:
        if os.path.exists(d + 'libtox64.dll'):
            os.remove(d + 'libtox64.dll')
        if os.path.exists(d + 'libsodium64.a'):
            os.remove(d + 'libsodium64.a')
    else:
        if os.path.exists(d + 'libtox.dll'):
            os.remove(d + 'libtox.dll')
        if os.path.exists(d + 'libsodium.a'):
            os.remove(d + 'libsodium.a')
        try:
            os.rename(d + 'libtox64.dll', d + 'libtox.dll')
            os.rename(d + 'libsodium64.a', d + 'libsodium.a')
        except:
            pass