Browse Source

Merge pull request #1016 from ThomasWaldmann/move-to-src

move to src/
TW 9 years ago
parent
commit
0aec338761
57 changed files with 31 additions and 52 deletions
  1. 1 1
      .coveragerc
  2. 2 1
      .gitignore
  3. 3 2
      MANIFEST.in
  4. 0 22
      conftest.py
  5. 24 22
      setup.py
  6. 0 0
      src/borg/__init__.py
  7. 0 0
      src/borg/__main__.py
  8. 0 0
      src/borg/_chunker.c
  9. 0 0
      src/borg/_hashindex.c
  10. 0 0
      src/borg/archive.py
  11. 0 0
      src/borg/archiver.py
  12. 0 0
      src/borg/cache.py
  13. 0 0
      src/borg/chunker.pyx
  14. 0 0
      src/borg/compress.pyx
  15. 0 0
      src/borg/constants.py
  16. 0 0
      src/borg/crypto.pyx
  17. 0 0
      src/borg/fuse.py
  18. 0 0
      src/borg/hash_sizes.py
  19. 0 0
      src/borg/hashindex.pyx
  20. 0 0
      src/borg/helpers.py
  21. 0 0
      src/borg/item.py
  22. 0 0
      src/borg/key.py
  23. 0 0
      src/borg/locking.py
  24. 0 0
      src/borg/logger.py
  25. 0 0
      src/borg/lrucache.py
  26. 0 0
      src/borg/platform.py
  27. 0 0
      src/borg/platform_base.py
  28. 0 0
      src/borg/platform_darwin.pyx
  29. 0 0
      src/borg/platform_freebsd.pyx
  30. 0 0
      src/borg/platform_linux.pyx
  31. 0 0
      src/borg/platform_posix.pyx
  32. 0 0
      src/borg/remote.py
  33. 0 0
      src/borg/repository.py
  34. 0 0
      src/borg/selftest.py
  35. 0 0
      src/borg/shellpattern.py
  36. 0 0
      src/borg/testsuite/__init__.py
  37. 0 0
      src/borg/testsuite/archive.py
  38. 0 0
      src/borg/testsuite/archiver.py
  39. 0 0
      src/borg/testsuite/benchmark.py
  40. 0 0
      src/borg/testsuite/chunker.py
  41. 0 0
      src/borg/testsuite/compress.py
  42. 0 0
      src/borg/testsuite/crypto.py
  43. 0 0
      src/borg/testsuite/hashindex.py
  44. 0 0
      src/borg/testsuite/helpers.py
  45. 0 0
      src/borg/testsuite/item.py
  46. 0 0
      src/borg/testsuite/key.py
  47. 0 0
      src/borg/testsuite/locking.py
  48. 0 0
      src/borg/testsuite/logger.py
  49. 0 0
      src/borg/testsuite/lrucache.py
  50. 0 0
      src/borg/testsuite/platform.py
  51. 0 0
      src/borg/testsuite/repository.py
  52. 0 0
      src/borg/testsuite/shellpattern.py
  53. 0 0
      src/borg/testsuite/upgrader.py
  54. 0 0
      src/borg/testsuite/xattr.py
  55. 0 0
      src/borg/upgrader.py
  56. 0 0
      src/borg/xattr.py
  57. 1 4
      tox.ini

+ 1 - 1
.coveragerc

@@ -1,6 +1,6 @@
 [run]
 [run]
 branch = True
 branch = True
-source = borg
+source = src/borg
 omit =
 omit =
     */borg/__init__.py
     */borg/__init__.py
     */borg/__main__.py
     */borg/__main__.py

+ 2 - 1
.gitignore

@@ -11,13 +11,14 @@ crypto.c
 platform_darwin.c
 platform_darwin.c
 platform_freebsd.c
 platform_freebsd.c
 platform_linux.c
 platform_linux.c
+platform_posix.c
 *.egg-info
 *.egg-info
 *.pyc
 *.pyc
 *.pyo
 *.pyo
 *.so
 *.so
 .idea/
 .idea/
 .cache/
 .cache/
-borg/_version.py
+src/borg/_version.py
 borg.build/
 borg.build/
 borg.dist/
 borg.dist/
 borg.exe
 borg.exe

+ 3 - 2
MANIFEST.in

@@ -1,9 +1,10 @@
 include README.rst AUTHORS LICENSE CHANGES.rst MANIFEST.in
 include README.rst AUTHORS LICENSE CHANGES.rst MANIFEST.in
-recursive-include borg *.pyx
+graft src
+recursive-exclude src *.pyc
+recursive-exclude src *.pyo
 recursive-include docs *
 recursive-include docs *
 recursive-exclude docs *.pyc
 recursive-exclude docs *.pyc
 recursive-exclude docs *.pyo
 recursive-exclude docs *.pyo
 prune docs/_build
 prune docs/_build
 prune .travis
 prune .travis
 exclude .coveragerc .gitattributes .gitignore .travis.yml Vagrantfile
 exclude .coveragerc .gitattributes .gitignore .travis.yml Vagrantfile
-include borg/_version.py

+ 0 - 22
conftest.py

@@ -1,25 +1,3 @@
-import os.path
-import sys
-
-# This is a hack to fix path problems because "borg" (the package) is in the source root.
-# When importing the conftest an "import borg" can incorrectly import the borg from the
-# source root instead of the one installed in the environment.
-# The workaround is to remove entries pointing there from the path and check whether "borg"
-# is still importable. If it is not, then it has not been installed in the environment
-# and the entries are put back.
-#
-# TODO: After moving the package to src/: remove this.
-
-original_path = list(sys.path)
-for entry in original_path:
-    if entry == '' or entry == os.path.dirname(__file__):
-        sys.path.remove(entry)
-
-try:
-    import borg
-except ImportError:
-    sys.path = original_path
-
 from borg.logger import setup_logging
 from borg.logger import setup_logging
 
 
 # Ensure that the loggers exist for all tests
 # Ensure that the loggers exist for all tests

+ 24 - 22
setup.py

@@ -38,18 +38,17 @@ if sys.platform.startswith('freebsd'):
     # llfuse 0.41.1 is the latest release that actually builds on freebsd:
     # llfuse 0.41.1 is the latest release that actually builds on freebsd:
     extras_require['fuse'] = ['llfuse==0.41.1', ]
     extras_require['fuse'] = ['llfuse==0.41.1', ]
 
 
-from setuptools import setup, Extension
+from setuptools import setup, find_packages, Extension
 from setuptools.command.sdist import sdist
 from setuptools.command.sdist import sdist
 
 
-
-compress_source = 'borg/compress.pyx'
-crypto_source = 'borg/crypto.pyx'
-chunker_source = 'borg/chunker.pyx'
-hashindex_source = 'borg/hashindex.pyx'
-platform_posix_source = 'borg/platform_posix.pyx'
-platform_linux_source = 'borg/platform_linux.pyx'
-platform_darwin_source = 'borg/platform_darwin.pyx'
-platform_freebsd_source = 'borg/platform_freebsd.pyx'
+compress_source = 'src/borg/compress.pyx'
+crypto_source = 'src/borg/crypto.pyx'
+chunker_source = 'src/borg/chunker.pyx'
+hashindex_source = 'src/borg/hashindex.pyx'
+platform_posix_source = 'src/borg/platform_posix.pyx'
+platform_linux_source = 'src/borg/platform_linux.pyx'
+platform_darwin_source = 'src/borg/platform_darwin.pyx'
+platform_freebsd_source = 'src/borg/platform_freebsd.pyx'
 
 
 try:
 try:
     from Cython.Distutils import build_ext
     from Cython.Distutils import build_ext
@@ -57,20 +56,20 @@ try:
 
 
     class Sdist(sdist):
     class Sdist(sdist):
         def __init__(self, *args, **kwargs):
         def __init__(self, *args, **kwargs):
-            for src in glob('borg/*.pyx'):
+            for src in glob('src/borg/*.pyx'):
                 cython_compiler.compile(src, cython_compiler.default_options)
                 cython_compiler.compile(src, cython_compiler.default_options)
             super().__init__(*args, **kwargs)
             super().__init__(*args, **kwargs)
 
 
         def make_distribution(self):
         def make_distribution(self):
             self.filelist.extend([
             self.filelist.extend([
-                'borg/compress.c',
-                'borg/crypto.c',
-                'borg/chunker.c', 'borg/_chunker.c',
-                'borg/hashindex.c', 'borg/_hashindex.c',
-                'borg/platform_posix.c',
-                'borg/platform_linux.c',
-                'borg/platform_freebsd.c',
-                'borg/platform_darwin.c',
+                'src/borg/compress.c',
+                'src/borg/crypto.c',
+                'src/borg/chunker.c', 'src/borg/_chunker.c',
+                'src/borg/hashindex.c', 'src/borg/_hashindex.c',
+                'src/borg/platform_posix.c',
+                'src/borg/platform_linux.c',
+                'src/borg/platform_freebsd.c',
+                'src/borg/platform_darwin.c',
             ])
             ])
             super().make_distribution()
             super().make_distribution()
 
 
@@ -269,7 +268,7 @@ class build_api(Command):
 API Documentation
 API Documentation
 =================
 =================
 """)
 """)
-            for mod in glob('borg/*.py') + glob('borg/*.pyx'):
+            for mod in glob('src/borg/*.py') + glob('src/borg/*.pyx'):
                 print("examining module %s" % mod)
                 print("examining module %s" % mod)
                 mod = mod.replace('.pyx', '').replace('.py', '').replace('/', '.')
                 mod = mod.replace('.pyx', '').replace('.py', '').replace('/', '.')
                 if "._" not in mod:
                 if "._" not in mod:
@@ -308,7 +307,7 @@ if not on_rtd:
 setup(
 setup(
     name='borgbackup',
     name='borgbackup',
     use_scm_version={
     use_scm_version={
-        'write_to': 'borg/_version.py',
+        'write_to': 'src/borg/_version.py',
     },
     },
     author='The Borg Collective (see AUTHORS file)',
     author='The Borg Collective (see AUTHORS file)',
     author_email='borgbackup@python.org',
     author_email='borgbackup@python.org',
@@ -334,7 +333,10 @@ setup(
         'Topic :: Security :: Cryptography',
         'Topic :: Security :: Cryptography',
         'Topic :: System :: Archiving :: Backup',
         'Topic :: System :: Archiving :: Backup',
     ],
     ],
-    packages=['borg', 'borg.testsuite', ],
+    packages=find_packages('src'),
+    package_dir={'': 'src'},
+    include_package_data=True,
+    zip_safe=False,
     entry_points={
     entry_points={
         'console_scripts': [
         'console_scripts': [
             'borg = borg.archiver:main',
             'borg = borg.archiver:main',

+ 0 - 0
borg/__init__.py → src/borg/__init__.py


+ 0 - 0
borg/__main__.py → src/borg/__main__.py


+ 0 - 0
borg/_chunker.c → src/borg/_chunker.c


+ 0 - 0
borg/_hashindex.c → src/borg/_hashindex.c


+ 0 - 0
borg/archive.py → src/borg/archive.py


+ 0 - 0
borg/archiver.py → src/borg/archiver.py


+ 0 - 0
borg/cache.py → src/borg/cache.py


+ 0 - 0
borg/chunker.pyx → src/borg/chunker.pyx


+ 0 - 0
borg/compress.pyx → src/borg/compress.pyx


+ 0 - 0
borg/constants.py → src/borg/constants.py


+ 0 - 0
borg/crypto.pyx → src/borg/crypto.pyx


+ 0 - 0
borg/fuse.py → src/borg/fuse.py


+ 0 - 0
borg/hash_sizes.py → src/borg/hash_sizes.py


+ 0 - 0
borg/hashindex.pyx → src/borg/hashindex.pyx


+ 0 - 0
borg/helpers.py → src/borg/helpers.py


+ 0 - 0
borg/item.py → src/borg/item.py


+ 0 - 0
borg/key.py → src/borg/key.py


+ 0 - 0
borg/locking.py → src/borg/locking.py


+ 0 - 0
borg/logger.py → src/borg/logger.py


+ 0 - 0
borg/lrucache.py → src/borg/lrucache.py


+ 0 - 0
borg/platform.py → src/borg/platform.py


+ 0 - 0
borg/platform_base.py → src/borg/platform_base.py


+ 0 - 0
borg/platform_darwin.pyx → src/borg/platform_darwin.pyx


+ 0 - 0
borg/platform_freebsd.pyx → src/borg/platform_freebsd.pyx


+ 0 - 0
borg/platform_linux.pyx → src/borg/platform_linux.pyx


+ 0 - 0
borg/platform_posix.pyx → src/borg/platform_posix.pyx


+ 0 - 0
borg/remote.py → src/borg/remote.py


+ 0 - 0
borg/repository.py → src/borg/repository.py


+ 0 - 0
borg/selftest.py → src/borg/selftest.py


+ 0 - 0
borg/shellpattern.py → src/borg/shellpattern.py


+ 0 - 0
borg/testsuite/__init__.py → src/borg/testsuite/__init__.py


+ 0 - 0
borg/testsuite/archive.py → src/borg/testsuite/archive.py


+ 0 - 0
borg/testsuite/archiver.py → src/borg/testsuite/archiver.py


+ 0 - 0
borg/testsuite/benchmark.py → src/borg/testsuite/benchmark.py


+ 0 - 0
borg/testsuite/chunker.py → src/borg/testsuite/chunker.py


+ 0 - 0
borg/testsuite/compress.py → src/borg/testsuite/compress.py


+ 0 - 0
borg/testsuite/crypto.py → src/borg/testsuite/crypto.py


+ 0 - 0
borg/testsuite/hashindex.py → src/borg/testsuite/hashindex.py


+ 0 - 0
borg/testsuite/helpers.py → src/borg/testsuite/helpers.py


+ 0 - 0
borg/testsuite/item.py → src/borg/testsuite/item.py


+ 0 - 0
borg/testsuite/key.py → src/borg/testsuite/key.py


+ 0 - 0
borg/testsuite/locking.py → src/borg/testsuite/locking.py


+ 0 - 0
borg/testsuite/logger.py → src/borg/testsuite/logger.py


+ 0 - 0
borg/testsuite/lrucache.py → src/borg/testsuite/lrucache.py


+ 0 - 0
borg/testsuite/platform.py → src/borg/testsuite/platform.py


+ 0 - 0
borg/testsuite/repository.py → src/borg/testsuite/repository.py


+ 0 - 0
borg/testsuite/shellpattern.py → src/borg/testsuite/shellpattern.py


+ 0 - 0
borg/testsuite/upgrader.py → src/borg/testsuite/upgrader.py


+ 0 - 0
borg/testsuite/xattr.py → src/borg/testsuite/xattr.py


+ 0 - 0
borg/upgrader.py → src/borg/upgrader.py


+ 0 - 0
borg/xattr.py → src/borg/xattr.py


+ 1 - 4
tox.ini

@@ -5,13 +5,10 @@
 envlist = py{34,35,36},flake8
 envlist = py{34,35,36},flake8
 
 
 [testenv]
 [testenv]
-# Change dir to avoid import problem for cython code. The directory does
-# not really matter, should be just different from the toplevel dir.
-changedir = {toxworkdir}
 deps =
 deps =
      -rrequirements.d/development.txt
      -rrequirements.d/development.txt
      attic
      attic
-commands = py.test --cov=borg --cov-config=../.coveragerc --benchmark-skip --pyargs {posargs:borg.testsuite}
+commands = py.test --cov=borg --cov-config=.coveragerc --benchmark-skip --pyargs {posargs:borg.testsuite}
 # fakeroot -u needs some env vars:
 # fakeroot -u needs some env vars:
 passenv = *
 passenv = *