Add a push command to setup.py so I can develop pn linux and seamlessly test on other platforms

This commit is contained in:
Kovid Goyal 2010-10-09 10:45:24 -06:00
parent ac7a7b8a31
commit 4dc70a8f97
2 changed files with 29 additions and 8 deletions

View File

@ -19,7 +19,7 @@ __all__ = [
'upload_user_manual', 'upload_to_mobileread', 'upload_demo',
'upload_to_sourceforge', 'upload_to_google_code',
'linux32', 'linux64', 'linux', 'linux_freeze', 'linux_freeze2',
'osx32_freeze', 'osx32', 'osx', 'rsync',
'osx32_freeze', 'osx32', 'osx', 'rsync', 'push',
'win32_freeze', 'win32', 'win',
'stage1', 'stage2', 'stage3', 'stage4', 'publish'
]
@ -68,8 +68,9 @@ upload_to_server = UploadToServer()
upload_to_sourceforge = UploadToSourceForge()
upload_to_google_code = UploadToGoogleCode()
from setup.installer import Rsync
from setup.installer import Rsync, Push
rsync = Rsync()
push = Push()
from setup.installer.linux import Linux, Linux32, Linux64
linux = Linux()

View File

@ -11,16 +11,21 @@ import subprocess, tempfile, os, time
from setup import Command, installer_name
from setup.build_environment import HOST, PROJECT
BASE_RSYNC = 'rsync -avz --delete'.split()
EXCLUDES = []
for x in [
'src/calibre/plugins', 'src/calibre/manual', 'src/calibre/trac',
'.bzr', '.build', '.svn', 'build', 'dist', 'imgsrc', '*.pyc', '*.pyo', '*.swp',
'*.swo']:
EXCLUDES.extend(['--exclude', x])
SAFE_EXCLUDES = ['"%s"'%x if '*' in x else x for x in EXCLUDES]
class Rsync(Command):
description = 'Sync source tree from development machine'
SYNC_CMD = ('rsync -avz --delete --exclude src/calibre/plugins '
'--exclude src/calibre/manual --exclude src/calibre/trac '
'--exclude .bzr --exclude .build --exclude .svn --exclude build --exclude dist '
'--exclude imgsrc '
'--exclude "*.pyc" --exclude "*.pyo" --exclude "*.swp" --exclude "*.swo" '
'rsync://{host}/work/{project} ..')
SYNC_CMD = ' '.join(BASE_RSYNC+SAFE_EXCLUDES+
['rsync://{host}/work/{project}', '..'])
def run(self, opts):
cmd = self.SYNC_CMD.format(host=HOST, project=PROJECT)
@ -28,6 +33,21 @@ class Rsync(Command):
subprocess.check_call(cmd, shell=True)
class Push(Command):
description = 'Push code to another host'
def run(self, opts):
for host in (
r'Owner@winxp:/cygdrive/c/Documents\ and\ Settings/Owner/calibre',
'kovid@ox:calibre'
):
rcmd = BASE_RSYNC + EXCLUDES + ['.', host]
print '\n\nPushing to:', host, '\n'
subprocess.check_call(rcmd)
class VMInstaller(Command):
EXTRA_SLEEP = 5