def test_generate_deb_from_directory(): tempdir = tempfile.gettempdir() checkout_dir = os.path.join(tempdir, 'vdist') git_p = subprocess.Popen( ['git', 'clone', 'https://github.com/objectified/vdist', checkout_dir]) git_p.communicate() builder = Builder() builder.add_build( app='vdist-test-generate-deb-from-dir', version='1.0', source=directory( path=checkout_dir, ), profile='ubuntu-trusty' ) builder.build() homedir = os.path.expanduser('~') target_file = os.path.join( homedir, '.vdist', 'dist', 'vdist-test-generate-deb-from-dir-1.0-ubuntu-trusty', 'vdist-test-generate-deb-from-dir_1.0_amd64.deb' ) assert os.path.isfile(target_file) assert os.path.getsize(target_file) > 0
def test_generate_deb_from_git(): builder = Builder() builder.add_build( app='vdist-test-generate-deb-from-git', version='1.0', source=git( uri='https://github.com/objectified/vdist', branch='master' ), profile='ubuntu-trusty' ) builder.build() homedir = os.path.expanduser('~') target_file = os.path.join( homedir, '.vdist', 'dist', 'vdist-test-generate-deb-from-git-1.0-ubuntu-trusty', 'vdist-test-generate-deb-from-git_1.0_amd64.deb' ) assert os.path.isfile(target_file) assert os.path.getsize(target_file) > 0
recommend for cross platform stability and packaging speed) """ from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( name='my great project', app='myproject', version='1.0', source=git( uri='https://github.com/someuser/someproject', branch='your-release-branch' ), profile='ubuntu-trusty', # tell vdist not to compile Python compile_python=False, # point to the basedir your custom Python is installed in # vdist will look for $basedir/bin/python python_basedir='/opt/mycompany/python', # provide your custom Python OS package as a build dependency build_deps=['mycompany-python'], # provide your custom Python OS package as a runtime dependency runtime_deps=['mycompany-python'] ) builder.build()
from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( name='my project build', app='myproject', version='1.0', source=git( uri='https://github.com/someuser/someproject', branch='your-release-branch' ), profile='ubuntu-trusty', # Tell vdist that we need the OS packages "ffmpeg" and "imagemagick" # on the system this application gets deployed # These packages will be made dependencies of the resulting OS package runtime_deps=['ffmpeg', 'imagemagick'], # tell vdist that on the machine that is used for building this project, # we will need the OS packages "libimagemagick-dev" and # "libmysqlclient-dev" # before we start building build_deps=['libimagemagick-dev', 'libmysqlclient-dev'] ) builder.build()
import os from vdist.builder import Builder from vdist.source import directory builder = Builder() builder.add_build( app='vdist-django-example', version='1.0', source=directory(path=os.getcwd()), profile='centos6' ) builder.build()
""" This example shows how you can use vdist to use a subdirectory under your source tree to use as the base for your OS package You will still be able to use git branching to point to the right release, since vdist will first checkout the parent, and set apart the subdirectory after switching to the right branch """ from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( name='my great project', app='myproject', version='1.0', source=git(uri='https://github.com/someuser/someproject', branch='your-release-branch'), profile='ubuntu-trusty', # specify 'subapp' as the working directory for this build; # this means that only the subapp directory will be built and # packaged # This also means that vdist will look for a pip requirements # file in this directory working_dir='subapp') builder.build()
from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( name='my project build', app='myproject', version='1.0', source=git(uri='https://github.com/someuser/someproject', branch='your-release-branch'), profile='ubuntu-trusty', # Tell vdist that we need the OS packages "ffmpeg" and "imagemagick" # on the system this application gets deployed # These packages will be made dependencies of the resulting OS package runtime_deps=['ffmpeg', 'imagemagick'], # tell vdist that on the machine that is used for building this project, # we will need the OS packages "libimagemagick-dev" and # "libmysqlclient-dev" # before we start building build_deps=['libimagemagick-dev', 'libmysqlclient-dev']) builder.build()
from vdist.builder import Builder from vdist.source import git builder = Builder() # add CentOS6 build builder.add_build( name='myproject centos6 build', app='myproject', version='1.0', source=git( uri='http://yourgithost.internal/yourcompany/yourproject', branch='master' ), profile='centos6' ) # add CentOS7 build builder.add_build( name='myproject centos7 build', app='myproject', version='1.0', source=git( uri='http://yourgithost.internal/yourcompany/yourproject', branch='master' ), profile='centos7' ) # add Ubuntu Trusty build builder.add_build(
def _call_builder(builder_parameters): builder = Builder() builder.add_build(**builder_parameters) builder.build()
""" This example shows how you can point to an alternative pip requirements file to use when building your OS package """ from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( name='my great project', app='myproject', version='1.0', source=git( uri='https://github.com/someuser/someproject', branch='your-release-branch' ), profile='ubuntu-trusty', # path will be used relative to your checkout directory # by default vdist will look for $checkout/requirements.txt requirements_path='/requirements/production.txt' ) builder.build()
import os from vdist.builder import Builder from vdist.source import directory builder = Builder() builder.add_build(app='vdist-django-example', version='1.0', source=directory(path=os.getcwd()), profile='centos6') builder.build()
from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( app='pydemo', version='1.0', source=git( uri='https://github.com/xiyangliu/pydemo', branch='master' ), profile='ubuntu-trusty' ) builder.build()
from vdist.builder import Builder from vdist.source import directory, git_directory builder = Builder() # build from a local directory builder.add_build( name='my directory based build', app='myproject', version='1.0', source=directory( path='/home/user/dev/yourproject' ), profile='centos6' ) # or, build from a git repo *inside* a local directory builder.add_build( name='my directory based build', app='myproject', version='1.0', source=git_directory( path='/home/user/dev/anotherproject', branch='your-release-branch' ), profile='centos6' ) # .. and build them in parallel builder.build()
""" This example shows how you can tell vdist to use your local pip configuration (~/.pip/pip.conf) when building. This is useful when you're using an internal PyPI index (highly recommended) """ from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( name='my great project', app='myproject', version='1.0', source=git(uri='https://github.com/someuser/someproject', branch='your-release-branch'), profile='ubuntu-trusty', # this means that during the build run, vdist will # copy your pip config (~/.pip/pip.conf) to the Docker # container it uses to build the OS package, so that you # can use your internal modules as pip dependencies in # your requirements.txt / setup.py use_local_pip_conf=True) builder.build()
from vdist.builder import Builder from vdist.source import git builder = Builder() # add CentOS6 build builder.add_build( name="myproject centos6 build", app="myproject", version="1.0", source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"), profile="centos6", ) # add CentOS7 build builder.add_build( name="myproject centos7 build", app="myproject", version="1.0", source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"), profile="centos7", ) # add Ubuntu Trusty build builder.add_build( name="myproject ubuntu build", app="myproject", version="1.0", source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"), profile="ubuntu-trusty", )
""" This example shows how you can use vdist to use a subdirectory under your source tree to use as the base for your OS package You will still be able to use git branching to point to the right release, since vdist will first checkout the parent, and set apart the subdirectory after switching to the right branch """ from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( name="my great project", app="myproject", version="1.0", source=git(uri="https://github.com/someuser/someproject", branch="your-release-branch"), profile="ubuntu-trusty", # specify 'subapp' as the working directory for this build; # this means that only the subapp directory will be built and # packaged # This also means that vdist will look for a pip requirements # file in this directory working_dir="subapp", ) builder.build()
from vdist.builder import Builder from vdist.source import directory, git_directory builder = Builder() # build from a local directory builder.add_build(name='my directory based build', app='myproject', version='1.0', source=directory(path='/home/user/dev/yourproject'), profile='centos6') # or, build from a git repo *inside* a local directory builder.add_build(name='my directory based build', app='myproject', version='1.0', source=git_directory(path='/home/user/dev/anotherproject', branch='your-release-branch'), profile='centos6') # .. and build them in parallel builder.build()
""" This example shows how you can tell vdist to use your local pip configuration (~/.pip/pip.conf) when building. This is useful when you're using an internal PyPI index (highly recommended) """ from vdist.builder import Builder from vdist.source import git builder = Builder() builder.add_build( name='my great project', app='myproject', version='1.0', source=git( uri='https://github.com/someuser/someproject', branch='your-release-branch' ), profile='ubuntu-trusty', # this means that during the build run, vdist will # copy your pip config (~/.pip/pip.conf) to the Docker # container it uses to build the OS package, so that you # can use your internal modules as pip dependencies in # your requirements.txt / setup.py use_local_pip_conf=True ) builder.build()