瀏覽代碼

Merge branch 'master' into vagrant

Thomas Waldmann 9 年之前
父節點
當前提交
de39683883
共有 4 個文件被更改,包括 48 次插入12 次删除
  1. 1 1
      borg/testsuite/compress.py
  2. 6 4
      docs/installation.rst
  3. 2 0
      docs/usage.rst
  4. 39 7
      setup.py

+ 1 - 1
borg/testsuite/compress.py

@@ -93,7 +93,7 @@ def test_compressor():
         params_list += [
         params_list += [
             dict(name='lzma', level=0, buffer=buffer),
             dict(name='lzma', level=0, buffer=buffer),
             dict(name='lzma', level=6, buffer=buffer),
             dict(name='lzma', level=6, buffer=buffer),
-            dict(name='lzma', level=9, buffer=buffer),
+            # we do not test lzma on level 9 because of the huge memory needs
         ]
         ]
     for params in params_list:
     for params in params_list:
         c = Compressor(**params)
         c = Compressor(**params)

+ 6 - 4
docs/installation.rst

@@ -127,7 +127,7 @@ Debian Jessie / Ubuntu 14.04 preparations (git/pypi)
     # in case you get complaints about permission denied on /etc/fuse.conf:
     # in case you get complaints about permission denied on /etc/fuse.conf:
     # on ubuntu this means your user is not in the "fuse" group. just add
     # on ubuntu this means your user is not in the "fuse" group. just add
     # yourself there, log out and log in again.
     # yourself there, log out and log in again.
-    apt-get install libfuse-dev fuse
+    apt-get install libfuse-dev fuse pkg-config
 
 
     # optional: for unit testing
     # optional: for unit testing
     apt-get install fakeroot
     apt-get install fakeroot
@@ -151,7 +151,7 @@ Korora / Fedora 21 preparations (git/pypi)
     sudo dnf install lz4-devel
     sudo dnf install lz4-devel
 
 
     # optional: FUSE support - to mount backup archives
     # optional: FUSE support - to mount backup archives
-    sudo dnf install fuse-devel fuse
+    sudo dnf install fuse-devel fuse pkgconfig
     
     
     # optional: for unit testing
     # optional: for unit testing
     sudo dnf install fakeroot
     sudo dnf install fakeroot
@@ -201,7 +201,8 @@ This uses the latest (source package) release from PyPi.
     source borg-env/bin/activate   # always before using!
     source borg-env/bin/activate   # always before using!
 
 
     # install borg + dependencies into virtualenv
     # install borg + dependencies into virtualenv
-    pip install llfuse  # optional, for FUSE support
+    pip install 'llfuse<0.41'  # optional, for FUSE support
+                               # 0.41 and 0.41.1 have unicode issues at install time
     pip install borgbackup
     pip install borgbackup
 
 
 Note: we install into a virtual environment here, but this is not a requirement.
 Note: we install into a virtual environment here, but this is not a requirement.
@@ -223,7 +224,8 @@ While we try not to break master, there are no guarantees on anything.
 
 
     # install borg + dependencies into virtualenv
     # install borg + dependencies into virtualenv
     pip install sphinx  # optional, to build the docs
     pip install sphinx  # optional, to build the docs
-    pip install llfuse  # optional, for FUSE support
+    pip install 'llfuse<0.41'  # optional, for FUSE support
+                               # 0.41 and 0.41.1 have unicode issues at install time
     cd borg
     cd borg
     pip install -r requirements.d/development.txt
     pip install -r requirements.d/development.txt
     pip install -e .  # in-place editable mode
     pip install -e .  # in-place editable mode

+ 2 - 0
docs/usage.rst

@@ -69,6 +69,8 @@ Directories:
 Building:
 Building:
     BORG_OPENSSL_PREFIX
     BORG_OPENSSL_PREFIX
         Adds given OpenSSL header file directory to the default locations (setup.py).
         Adds given OpenSSL header file directory to the default locations (setup.py).
+    BORG_LZ4_PREFIX
+        Adds given LZ4 header file directory to the default locations (setup.py).
 
 
 
 
 Please note:
 Please note:

+ 39 - 7
setup.py

@@ -4,10 +4,22 @@ import sys
 from glob import glob
 from glob import glob
 
 
 min_python = (3, 2)
 min_python = (3, 2)
-if sys.version_info < min_python:
+my_python = sys.version_info
+
+if my_python < min_python:
     print("Borg requires Python %d.%d or later" % min_python)
     print("Borg requires Python %d.%d or later" % min_python)
     sys.exit(1)
     sys.exit(1)
 
 
+# msgpack pure python data corruption was fixed in 0.4.6.
+# Also, we might use some rather recent API features.
+install_requires=['msgpack-python>=0.4.6', ]
+
+if (my_python < (3, 2, 4) or
+    (3, 3, 0) <= my_python < (3, 3, 1)):
+    # argparse in stdlib does not work there due to a bug,
+    # pull a fixed argparse from pypi
+    install_requires.append("argparse>=1.4.0")
+
 
 
 from setuptools import setup, Extension
 from setuptools import setup, Extension
 from setuptools.command.sdist import sdist
 from setuptools.command.sdist import sdist
@@ -71,14 +83,36 @@ def detect_openssl(prefixes):
                     return prefix
                     return prefix
 
 
 
 
+def detect_lz4(prefixes):
+    for prefix in prefixes:
+        filename = os.path.join(prefix, 'include', 'lz4.h')
+        if os.path.exists(filename):
+            with open(filename, 'r') as fd:
+                if 'LZ4_decompress_safe' in fd.read():
+                    return prefix
+
+
+include_dirs = []
+library_dirs = []
+
 possible_openssl_prefixes = ['/usr', '/usr/local', '/usr/local/opt/openssl', '/usr/local/ssl', '/usr/local/openssl', '/usr/local/borg', '/opt/local']
 possible_openssl_prefixes = ['/usr', '/usr/local', '/usr/local/opt/openssl', '/usr/local/ssl', '/usr/local/openssl', '/usr/local/borg', '/opt/local']
 if os.environ.get('BORG_OPENSSL_PREFIX'):
 if os.environ.get('BORG_OPENSSL_PREFIX'):
     possible_openssl_prefixes.insert(0, os.environ.get('BORG_OPENSSL_PREFIX'))
     possible_openssl_prefixes.insert(0, os.environ.get('BORG_OPENSSL_PREFIX'))
 ssl_prefix = detect_openssl(possible_openssl_prefixes)
 ssl_prefix = detect_openssl(possible_openssl_prefixes)
 if not ssl_prefix:
 if not ssl_prefix:
     raise Exception('Unable to find OpenSSL >= 1.0 headers. (Looked here: {})'.format(', '.join(possible_openssl_prefixes)))
     raise Exception('Unable to find OpenSSL >= 1.0 headers. (Looked here: {})'.format(', '.join(possible_openssl_prefixes)))
-include_dirs = [os.path.join(ssl_prefix, 'include')]
-library_dirs = [os.path.join(ssl_prefix, 'lib')]
+include_dirs.append(os.path.join(ssl_prefix, 'include'))
+library_dirs.append(os.path.join(ssl_prefix, 'lib'))
+
+
+possible_lz4_prefixes = ['/usr', '/usr/local', '/usr/local/borg', '/opt/local']
+if os.environ.get('BORG_LZ4_PREFIX'):
+    possible_openssl_prefixes.insert(0, os.environ.get('BORG_LZ4_PREFIX'))
+lz4_prefix = detect_lz4(possible_lz4_prefixes)
+if not lz4_prefix:
+    raise Exception('Unable to find LZ4 headers. (Looked here: {})'.format(', '.join(possible_lz4_prefixes)))
+include_dirs.append(os.path.join(lz4_prefix, 'include'))
+library_dirs.append(os.path.join(lz4_prefix, 'lib'))
 
 
 
 
 with open('README.rst', 'r') as fd:
 with open('README.rst', 'r') as fd:
@@ -87,7 +121,7 @@ with open('README.rst', 'r') as fd:
 cmdclass = {'build_ext': build_ext, 'sdist': Sdist}
 cmdclass = {'build_ext': build_ext, 'sdist': Sdist}
 
 
 ext_modules = [
 ext_modules = [
-    Extension('borg.compress', [compress_source], libraries=['lz4']),
+    Extension('borg.compress', [compress_source], libraries=['lz4'], include_dirs=include_dirs, library_dirs=library_dirs),
     Extension('borg.crypto', [crypto_source], libraries=['crypto'], include_dirs=include_dirs, library_dirs=library_dirs),
     Extension('borg.crypto', [crypto_source], libraries=['crypto'], include_dirs=include_dirs, library_dirs=library_dirs),
     Extension('borg.chunker', [chunker_source]),
     Extension('borg.chunker', [chunker_source]),
     Extension('borg.hashindex', [hashindex_source])
     Extension('borg.hashindex', [hashindex_source])
@@ -136,7 +170,5 @@ setup(
     cmdclass=cmdclass,
     cmdclass=cmdclass,
     ext_modules=ext_modules,
     ext_modules=ext_modules,
     setup_requires=['setuptools_scm>=1.7'],
     setup_requires=['setuptools_scm>=1.7'],
-    # msgpack pure python data corruption was fixed in 0.4.6.
-    # Also, we might use some rather recent API features.
-    install_requires=['msgpack-python>=0.4.6'],
+    install_requires=install_requires,
 )
 )