Distribute source compressed with xz instead of gzip for a 40% reduction in size

This commit is contained in:
Kovid Goyal 2011-12-02 16:29:03 +05:30
parent 85b23cf061
commit b10ce82a00
3 changed files with 15 additions and 12 deletions

View File

@ -283,8 +283,7 @@ class Install(Develop):
class Sdist(Command): class Sdist(Command):
description = 'Create a source distribution' description = 'Create a source distribution'
DEST = os.path.join('dist', '%s-%s.tar.gz'%(__appname__, __version__)) DEST = os.path.join('dist', '%s-%s.tar.xz'%(__appname__, __version__))
def run(self, opts): def run(self, opts):
if not self.e(self.d(self.DEST)): if not self.e(self.d(self.DEST)):
@ -313,7 +312,7 @@ class Sdist(Command):
shutil.copy2(f, dest) shutil.copy2(f, dest)
self.info('\tCreating tarfile...') self.info('\tCreating tarfile...')
subprocess.check_call(['tar', '-czf', self.a(self.DEST), subprocess.check_call(['tar', '-cJf', self.a(self.DEST),
'calibre'], cwd=self.d(tdir)) 'calibre'], cwd=self.d(tdir))
def clean(self): def clean(self):

View File

@ -25,12 +25,12 @@ MOBILEREAD = 'ftp://dev.mobileread.com/calibre/'
def installers(): def installers():
installers = list(map(installer_name, ('dmg', 'msi', 'tar.bz2'))) installers = list(map(installer_name, ('dmg', 'msi', 'tar.bz2')))
installers.append(installer_name('tar.bz2', is64bit=True)) installers.append(installer_name('tar.bz2', is64bit=True))
installers.insert(0, 'dist/%s-%s.tar.gz'%(__appname__, __version__)) installers.insert(0, 'dist/%s-%s.tar.xz'%(__appname__, __version__))
installers.append('dist/%s-portable-%s.zip'%(__appname__, __version__)) installers.append('dist/%s-portable-%s.zip'%(__appname__, __version__))
return installers return installers
def installer_description(fname): def installer_description(fname):
if fname.endswith('.tar.gz'): if fname.endswith('.tar.xz'):
return 'Source code' return 'Source code'
if fname.endswith('.tar.bz2'): if fname.endswith('.tar.bz2'):
bits = '32' if 'i686' in fname else '64' bits = '32' if 'i686' in fname else '64'
@ -117,7 +117,7 @@ class UploadToGoogleCode(Command): # {{{
def re_upload(self): def re_upload(self):
fnames = set([os.path.basename(x) for x in installers() if not fnames = set([os.path.basename(x) for x in installers() if not
x.endswith('.tar.gz') and os.path.exists(x)]) x.endswith('.tar.xz') and os.path.exists(x)])
existing = set(self.old_files.keys()).intersection(fnames) existing = set(self.old_files.keys()).intersection(fnames)
br = self.login_to_gmail() br = self.login_to_gmail()
for x in fnames: for x in fnames:
@ -134,11 +134,11 @@ class UploadToGoogleCode(Command): # {{{
def upload_one(self, fname): def upload_one(self, fname):
self.info('\nUploading', fname) self.info('\nUploading', fname)
typ = 'Type-' + ('Source' if fname.endswith('.gz') else 'Archive' if typ = 'Type-' + ('Source' if fname.endswith('.xz') else 'Archive' if
fname.endswith('.zip') else 'Installer') fname.endswith('.zip') else 'Installer')
ext = os.path.splitext(fname)[1][1:] ext = os.path.splitext(fname)[1][1:]
op = 'OpSys-'+{'msi':'Windows','zip':'Windows', op = 'OpSys-'+{'msi':'Windows','zip':'Windows',
'dmg':'OSX','bz2':'Linux','gz':'All'}[ext] 'dmg':'OSX','bz2':'Linux','xz':'All'}[ext]
desc = installer_description(fname) desc = installer_description(fname)
start = time.time() start = time.time()
for i in range(5): for i in range(5):
@ -475,11 +475,11 @@ class UploadToServer(Command): # {{{
description = 'Upload miscellaneous data to calibre server' description = 'Upload miscellaneous data to calibre server'
def run(self, opts): def run(self, opts):
check_call('ssh divok rm -f %s/calibre-\*.tar.gz'%DOWNLOADS, shell=True) check_call('ssh divok rm -f %s/calibre-\*.tar.xz'%DOWNLOADS, shell=True)
#check_call('scp dist/calibre-*.tar.gz divok:%s/'%DOWNLOADS, shell=True) #check_call('scp dist/calibre-*.tar.xz divok:%s/'%DOWNLOADS, shell=True)
check_call('gpg --armor --detach-sign dist/calibre-*.tar.gz', check_call('gpg --armor --detach-sign dist/calibre-*.tar.xz',
shell=True) shell=True)
check_call('scp dist/calibre-*.tar.gz.asc divok:%s/signatures/'%DOWNLOADS, check_call('scp dist/calibre-*.tar.xz.asc divok:%s/signatures/'%DOWNLOADS,
shell=True) shell=True)
check_call('ssh divok bzr update /usr/local/calibre', check_call('ssh divok bzr update /usr/local/calibre',
shell=True) shell=True)

View File

@ -89,6 +89,10 @@ Then just add this HTML file to the GUI and use the convert button to create you
.. note:: By default, when adding HTML files, |app| follows links in the files in *depth first* order. This means that if file A.html links to B.html and C.html and D.html, but B.html also links to D.html, then the files will be in the order A.html, B.html, D.html, C.html. If instead you want the order to be A.html, B.html, C.html, D.html then you must tell |app| to add your files in *breadth first* order. Do this by going to Preferences->Plugins and customizing the HTML to ZIP plugin. .. note:: By default, when adding HTML files, |app| follows links in the files in *depth first* order. This means that if file A.html links to B.html and C.html and D.html, but B.html also links to D.html, then the files will be in the order A.html, B.html, D.html, C.html. If instead you want the order to be A.html, B.html, C.html, D.html then you must tell |app| to add your files in *breadth first* order. Do this by going to Preferences->Plugins and customizing the HTML to ZIP plugin.
The EPUB I produced with |app| is not valid?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|app| does not guarantee that an EPUB produced by it is valid. The only guarantee it makes is that if you feed it valid XHTML 1.1 + CSS 2.1 it will output a valid EPUB. |app| is designed for ebook consumers, not producers. It tries hard to ensure that EPUBs it produces actually work as intended on a wide variety of devices, a goal that is incompatible with producing valid EPUBs, and one that is far more important to the vast majority of its users. If you need a tool that always produces valid EPUBs, |app| is not for you.
How do I use some of the advanced features of the conversion tools? How do I use some of the advanced features of the conversion tools?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~