diff --git a/MANIFEST.in b/MANIFEST.in index bd727e2c..067dc2ad 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,18 +1,18 @@ include NEWS include AUTHORS -include README.md -include README.swift.md +include README.rst +include README.swift.rst include Makefile include COPYING -include CONTRIBUTING.md +include CONTRIBUTING.rst include TODO include setup.cfg include dulwich/stdint.h recursive-include docs conf.py *.txt Makefile make.bat recursive-include examples *.py graft dulwich/tests/data include tox.ini include dulwich.cfg include appveyor.yml include .testr.conf include .travis.yml diff --git a/README.swift.md b/README.swift.rst similarity index 93% rename from README.swift.md rename to README.swift.rst index 2c82c4a0..7fefafc2 100644 --- a/README.swift.md +++ b/README.swift.rst @@ -1,133 +1,133 @@ Openstack Swift as backend for Dulwich ====================================== Fabien Boucher The module dulwich/contrib/swift.py implements dulwich.repo.BaseRepo in order to being compatible with Openstack Swift. We can then use Dulwich as server (Git server) and instead of using a regular POSIX file system to store repository objects we use the object storage Swift via its own API. c Git client <---> Dulwich server <---> Openstack Swift API This implementation is still a work in progress and we can say that is a Beta version so you need to be prepared to find bugs. Configuration file ------------------ We need to provide some configuration values in order to let Dulwich talk and authenticate against Swift. The following config file must -be used as template: +be used as template:: [swift] # Authentication URL (Keystone or Swift) auth_url = http://127.0.0.1:5000/v2.0 # Authentication version to use auth_ver = 2 # The tenant and username separated by a semicolon username = admin;admin # The user password password = pass # The Object storage region to use (auth v2) (Default RegionOne) region_name = RegionOne # The Object storage endpoint URL to use (auth v2) (Default internalURL) endpoint_type = internalURL # Concurrency to use for parallel tasks (Default 10) concurrency = 10 # Size of the HTTP pool (Default 10) http_pool_length = 10 # Timeout delay for HTTP connections (Default 20) http_timeout = 20 # Chunk size to read from pack (Bytes) (Default 12228) chunk_length = 12228 # Cache size (MBytes) (Default 20) cache_length = 20 Note that for now we use the same tenant to perform the requests against Swift. Therefor there is only one Swift account used for storing repositories. Each repository will be contained in a Swift container. How to start unittest --------------------- There is no need to have a Swift cluster running to run the unitests. -Just run the following command in the Dulwich source directory: +Just run the following command in the Dulwich source directory:: $ PYTHONPATH=. python -m dulwich.contrib.test_swift How to start functional tests ----------------------------- We provide some basic tests to perform smoke tests against a real Swift cluster. To run those functional tests you need a properly configured -configuration file. The tests can be run as follow: +configuration file. The tests can be run as follow:: $ DULWICH_SWIFT_CFG=/etc/swift-dul.conf PYTHONPATH=. python -m dulwich.contrib.test_swift_smoke How to install -------------- Install the Dulwich library via the setup.py. The dependencies will be -automatically retrieved from pypi: +automatically retrieved from pypi:: $ python ./setup.py install How to run the server --------------------- -Start the server using the following command: +Start the server using the following command:: $ python -m dulwich.contrib.swift daemon -c /etc/swift-dul.conf -l 127.0.0.1 Note that a lot of request will be performed against the Swift cluster so it is better to start the Dulwich server as close as possible of the Swift proxy. The best solution is to run the server on the Swift proxy node to reduce the latency. How to use ---------- Once you have validated that the functional tests is working as expected and the server is running we can init a bare repository. Run this -command with the name of the repository to create: +command with the name of the repository to create:: $ python -m dulwich.contrib.swift init -c /etc/swift-dul.conf edeploy The repository name will be the container that will contain all the Git objects for the repository. Then standard c Git client can be used to perform operations against this repository. -As an example we can clone the previously empty bare repository: +As an example we can clone the previously empty bare repository:: $ git clone git://localhost/edeploy -Then push an existing project in it: +Then push an existing project in it:: $ git clone https://github.com/enovance/edeploy.git edeployclone $ cd edeployclone $ git remote add alt git://localhost/edeploy $ git push alt master $ git ls-remote alt 9dc50a9a9bff1e232a74e365707f22a62492183e HEAD 9dc50a9a9bff1e232a74e365707f22a62492183e refs/heads/master The other Git commands can be used the way you do usually against a regular repository. Note the daemon subcommands starts a Git server listening for the Git protocol. Therefor there is no authentication or encryption at all between the cGIT client and the GIT server (Dulwich). Note on the .info file for pack object -------------------------------------- The Swift interface of Dulwich relies only on the pack format to store Git objects. Instead of using only an index (pack-sha.idx) along with the pack, we add a second file (pack-sha.info). This file is automatically created when a client pushes some references on the repository. The purpose of this file is to speed up pack creation server side when a client fetches some references. Currently this .info format is not optimized and may change in future. diff --git a/setup.py b/setup.py index c85e0b9c..c25747d3 100755 --- a/setup.py +++ b/setup.py @@ -1,125 +1,125 @@ #!/usr/bin/python # encoding: utf-8 # Setup file for dulwich # Copyright (C) 2008-2016 Jelmer Vernooij try: from setuptools import setup, Extension except ImportError: from distutils.core import setup, Extension has_setuptools = False else: has_setuptools = True from distutils.core import Distribution import io import os import sys dulwich_version_string = '0.19.10' include_dirs = [] # Windows MSVC support if sys.platform == 'win32' and sys.version_info[:2] < (3, 6): # Include dulwich/ for fallback stdint.h include_dirs.append('dulwich') class DulwichDistribution(Distribution): def is_pure(self): if self.pure: return True def has_ext_modules(self): return not self.pure global_options = Distribution.global_options + [ ('pure', None, "use pure Python code instead of C " "extensions (slower on CPython)")] pure = False if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'): # XCode 4.0 dropped support for ppc architecture, which is hardcoded in # distutils.sysconfig import subprocess p = subprocess.Popen( ['/usr/bin/xcodebuild', '-version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env={}) out, err = p.communicate() for line in out.splitlines(): line = line.decode("utf8") # Also parse only first digit, because 3.2.1 can't be parsed nicely if (line.startswith('Xcode') and int(line.split()[1].split('.')[0]) >= 4): os.environ['ARCHFLAGS'] = '' tests_require = ['fastimport'] if '__pypy__' not in sys.modules and not sys.platform == 'win32': tests_require.extend([ 'gevent', 'geventhttpclient', 'mock', 'setuptools>=17.1']) ext_modules = [ Extension('dulwich._objects', ['dulwich/_objects.c'], include_dirs=include_dirs), Extension('dulwich._pack', ['dulwich/_pack.c'], include_dirs=include_dirs), Extension('dulwich._diff_tree', ['dulwich/_diff_tree.c'], include_dirs=include_dirs), ] setup_kwargs = {} if has_setuptools: setup_kwargs['extras_require'] = { 'fastimport': ['fastimport'], 'https': ['urllib3[secure]>=1.21'], } setup_kwargs['install_requires'] = ['urllib3>=1.21', 'certifi'] setup_kwargs['include_package_data'] = True setup_kwargs['test_suite'] = 'dulwich.tests.test_suite' setup_kwargs['tests_require'] = tests_require -with io.open(os.path.join(os.path.dirname(__file__), "README.md"), +with io.open(os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8") as f: description = f.read() setup(name='dulwich', author="Jelmer Vernooij", author_email="jelmer@jelmer.uk", url="https://www.dulwich.io/", long_description=description, description="Python Git Library", version=dulwich_version_string, license='Apachev2 or later or GPLv2', project_urls={ "Bug Tracker": "https://github.com/dulwich/dulwich/issues", "Repository": "https://www.dulwich.io/code/", "GitHub": "https://github.com/dulwich/dulwich", }, keywords="git vcs", packages=['dulwich', 'dulwich.tests', 'dulwich.tests.compat', 'dulwich.contrib'], package_data={'': ['../docs/tutorial/*.txt']}, scripts=['bin/dulwich', 'bin/dul-receive-pack', 'bin/dul-upload-pack'], ext_modules=ext_modules, distclass=DulwichDistribution, classifiers=[ 'Development Status :: 4 - Beta', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Topic :: Software Development :: Version Control', ], **setup_kwargs )