Merge pull request #2381 from ThomasWaldmann/backports

1.0-maint backports
This commit is contained in:
TW 2017-04-03 22:38:48 +02:00 committed by GitHub
commit eedb2b582b
5 changed files with 17 additions and 129 deletions

View file

@ -204,6 +204,7 @@ class Archive:
if start is None:
start = datetime.utcnow()
start_monotonic = time.monotonic()
self.chunker_params = chunker_params
self.start = start
self.start_monotonic = start_monotonic
if end is None:
@ -227,7 +228,7 @@ class Archive:
raise self.DoesNotExist(name)
info = self.manifest.archives[name]
self.load(info[b'id'])
self.zeros = b'\0' * (1 << chunker_params[1])
self.zeros = None
def _load_meta(self, id):
data = self.key.decrypt(id, self.repository.get(id))
@ -405,6 +406,8 @@ Number of files: {0.stats.nfiles}'''.format(
with backup_io():
os.link(source, path)
else:
if sparse and self.zeros is None:
self.zeros = b'\0' * (1 << self.chunker_params[1])
with backup_io():
fd = open(path, 'wb')
with fd:

View file

@ -1,86 +0,0 @@
.. IMPORTANT: this file is auto-generated by "setup.py build_api", do not edit!
API Documentation
=================
.. automodule:: borg.archive
:members:
:undoc-members:
.. automodule:: borg.archiver
:members:
:undoc-members:
.. automodule:: borg.cache
:members:
:undoc-members:
.. automodule:: borg.chunker
:members:
:undoc-members:
.. automodule:: borg.compress
:members: get_compressor, Compressor, CompressorBase
:undoc-members:
.. automodule:: borg.crypto
:members:
:undoc-members:
.. automodule:: borg.fuse
:members:
:undoc-members:
.. automodule:: borg.hashindex
:members:
:undoc-members:
.. automodule:: borg.helpers
:members:
:undoc-members:
.. automodule:: borg.key
:members:
:undoc-members:
.. automodule:: borg.keymanager
:members:
:undoc-members:
.. automodule:: borg.locking
:members:
:undoc-members:
.. automodule:: borg.logger
:members:
:undoc-members:
.. automodule:: borg.lrucache
:members:
:undoc-members:
.. automodule:: borg.platform
:members:
:undoc-members:
.. automodule:: borg.platform_linux
:members:
:undoc-members:
.. automodule:: borg.remote
:members:
:undoc-members:
.. automodule:: borg.repository
:members:
:undoc-members:
.. automodule:: borg.shellpattern
:members:
:undoc-members:
.. automodule:: borg.xattr
:members:
:undoc-members:

View file

@ -183,20 +183,19 @@ Important notes:
Regenerate usage files
----------------------
Usage and API documentation is currently committed directly to git,
Usage documentation is currently committed directly to git,
although those files are generated automatically from the source
tree.
When a new module is added, the ``docs/api.rst`` file needs to be
regenerated::
./setup.py build_api
When a command is added, a commandline flag changed, added or removed,
the usage docs need to be rebuilt as well::
./setup.py build_usage
However, we prefer to do this as part of our :ref:`releasing`
preparations, so it is generally not necessary to update these when
submitting patches that change something about the command line.
Building the docs with Sphinx
-----------------------------
@ -270,7 +269,7 @@ Checklist:
- update ``CHANGES.rst``, based on ``git log $PREVIOUS_RELEASE..``
- check version number of upcoming release in ``CHANGES.rst``
- verify that ``MANIFEST.in`` and ``setup.py`` are complete
- ``python setup.py build_api ; python setup.py build_usage`` and commit
- ``python setup.py build_usage`` and commit
- tag the release::
git tag -s -m "tagged/signed release X.Y.Z" X.Y.Z

View file

@ -321,6 +321,13 @@ for a potential solution.
Please note that this workaround only helps you for backup, not for restore.
Can I backup my root partition (/) with Borg?
---------------------------------------------
Backing up your entire root partition works just fine, but remember to
exclude directories that make no sense to backup, such as /dev, /proc,
/sys, /tmp and /run.
If it crashes with a UnicodeError, what can I do?
-------------------------------------------------

View file

@ -213,43 +213,8 @@ class build_usage(Command):
return is_subcommand
class build_api(Command):
description = "generate a basic api.rst file based on the modules available"
user_options = [
('output=', 'O', 'output directory'),
]
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print("auto-generating API documentation")
with open("docs/api.rst", "w") as doc:
doc.write("""
.. IMPORTANT: this file is auto-generated by "setup.py build_api", do not edit!
API Documentation
=================
""")
for mod in sorted(glob('borg/*.py') + glob('borg/*.pyx')):
print("examining module %s" % mod)
mod = mod.replace('.pyx', '').replace('.py', '').replace('/', '.')
if "._" not in mod:
doc.write("""
.. automodule:: %s
:members:
:undoc-members:
""" % mod)
cmdclass = {
'build_ext': build_ext,
'build_api': build_api,
'build_usage': build_usage,
'sdist': Sdist
}