mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a push command to setup.py so I can develop pn linux and seamlessly test on other platforms
This commit is contained in:
parent
ac7a7b8a31
commit
4dc70a8f97
@ -19,7 +19,7 @@ __all__ = [
|
|||||||
'upload_user_manual', 'upload_to_mobileread', 'upload_demo',
|
'upload_user_manual', 'upload_to_mobileread', 'upload_demo',
|
||||||
'upload_to_sourceforge', 'upload_to_google_code',
|
'upload_to_sourceforge', 'upload_to_google_code',
|
||||||
'linux32', 'linux64', 'linux', 'linux_freeze', 'linux_freeze2',
|
'linux32', 'linux64', 'linux', 'linux_freeze', 'linux_freeze2',
|
||||||
'osx32_freeze', 'osx32', 'osx', 'rsync',
|
'osx32_freeze', 'osx32', 'osx', 'rsync', 'push',
|
||||||
'win32_freeze', 'win32', 'win',
|
'win32_freeze', 'win32', 'win',
|
||||||
'stage1', 'stage2', 'stage3', 'stage4', 'publish'
|
'stage1', 'stage2', 'stage3', 'stage4', 'publish'
|
||||||
]
|
]
|
||||||
@ -68,8 +68,9 @@ upload_to_server = UploadToServer()
|
|||||||
upload_to_sourceforge = UploadToSourceForge()
|
upload_to_sourceforge = UploadToSourceForge()
|
||||||
upload_to_google_code = UploadToGoogleCode()
|
upload_to_google_code = UploadToGoogleCode()
|
||||||
|
|
||||||
from setup.installer import Rsync
|
from setup.installer import Rsync, Push
|
||||||
rsync = Rsync()
|
rsync = Rsync()
|
||||||
|
push = Push()
|
||||||
|
|
||||||
from setup.installer.linux import Linux, Linux32, Linux64
|
from setup.installer.linux import Linux, Linux32, Linux64
|
||||||
linux = Linux()
|
linux = Linux()
|
||||||
|
@ -11,16 +11,21 @@ import subprocess, tempfile, os, time
|
|||||||
from setup import Command, installer_name
|
from setup import Command, installer_name
|
||||||
from setup.build_environment import HOST, PROJECT
|
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):
|
class Rsync(Command):
|
||||||
|
|
||||||
description = 'Sync source tree from development machine'
|
description = 'Sync source tree from development machine'
|
||||||
|
|
||||||
SYNC_CMD = ('rsync -avz --delete --exclude src/calibre/plugins '
|
SYNC_CMD = ' '.join(BASE_RSYNC+SAFE_EXCLUDES+
|
||||||
'--exclude src/calibre/manual --exclude src/calibre/trac '
|
['rsync://{host}/work/{project}', '..'])
|
||||||
'--exclude .bzr --exclude .build --exclude .svn --exclude build --exclude dist '
|
|
||||||
'--exclude imgsrc '
|
|
||||||
'--exclude "*.pyc" --exclude "*.pyo" --exclude "*.swp" --exclude "*.swo" '
|
|
||||||
'rsync://{host}/work/{project} ..')
|
|
||||||
|
|
||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
cmd = self.SYNC_CMD.format(host=HOST, project=PROJECT)
|
cmd = self.SYNC_CMD.format(host=HOST, project=PROJECT)
|
||||||
@ -28,6 +33,21 @@ class Rsync(Command):
|
|||||||
subprocess.check_call(cmd, shell=True)
|
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):
|
class VMInstaller(Command):
|
||||||
|
|
||||||
EXTRA_SLEEP = 5
|
EXTRA_SLEEP = 5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user