mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont error if file exists when building installer
This commit is contained in:
parent
47ac17d962
commit
e21f0a3acc
@ -2,8 +2,7 @@
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import,
|
||||
print_function)
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
import os, sys, subprocess
|
||||
|
||||
from setup import Command
|
||||
@ -15,7 +14,9 @@ def build_single(which, bitness, shutdown=True):
|
||||
build_calibre = os.path.join(d(base), 'build-calibre')
|
||||
build_calibre = os.environ.get('BUILD_CALIBRE_LOCATION', build_calibre)
|
||||
if not os.path.isdir(build_calibre):
|
||||
raise SystemExit('Cannot find the build-calibre code. Set the environment variable BUILD_CALIBRE_LOCATION to point to it')
|
||||
raise SystemExit(
|
||||
'Cannot find the build-calibre code. Set the environment variable BUILD_CALIBRE_LOCATION to point to it'
|
||||
)
|
||||
cmd = [sys.executable, os.path.join(build_calibre, which)]
|
||||
if bitness:
|
||||
cmd.append(bitness)
|
||||
@ -32,7 +33,12 @@ def build_single(which, bitness, shutdown=True):
|
||||
dist = os.path.join(dist, 'dist')
|
||||
for x in os.listdir(dist):
|
||||
print(x)
|
||||
os.link(os.path.join(dist, x), os.path.join(base, 'dist', x))
|
||||
dest = os.path.join(base, 'dist', x)
|
||||
try:
|
||||
os.remove(dest)
|
||||
except EnvironmentError:
|
||||
pass
|
||||
os.link(os.path.join(dist, x), dest)
|
||||
if shutdown and which != 'linux':
|
||||
cmd = [sys.executable, os.path.join(build_calibre, which), 'shutdown']
|
||||
subprocess.Popen(cmd, env=env, cwd=build_calibre).wait()
|
||||
@ -43,8 +49,12 @@ class BuildInstaller(Command):
|
||||
OS = BITNESS = ''
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.add_option('--dont-shutdown', default=False, action='store_true',
|
||||
help='Do not shutdown the VM after building')
|
||||
parser.add_option(
|
||||
'--dont-shutdown',
|
||||
default=False,
|
||||
action='store_true',
|
||||
help='Do not shutdown the VM after building'
|
||||
)
|
||||
|
||||
def run(self, opts):
|
||||
build_single(self.OS, self.BITNESS, not opts.dont_shutdown)
|
||||
@ -60,31 +70,38 @@ class BuildInstallers(BuildInstaller):
|
||||
shutdown = bitness is bits[-1] and not opts.dont_shutdown
|
||||
build_single(self.OS, bitness, shutdown)
|
||||
|
||||
|
||||
class Linux32(BuildInstaller):
|
||||
OS = 'linux'
|
||||
BITNESS = '32'
|
||||
description = 'Build the 32-bit linux calibre installer'
|
||||
|
||||
|
||||
class Linux64(BuildInstaller):
|
||||
OS = 'linux'
|
||||
BITNESS = '64'
|
||||
description = 'Build the 64-bit linux calibre installer'
|
||||
|
||||
|
||||
class Win32(BuildInstaller):
|
||||
OS = 'win'
|
||||
BITNESS = '32'
|
||||
description = 'Build the 32-bit windows calibre installers'
|
||||
|
||||
|
||||
class Win64(BuildInstaller):
|
||||
OS = 'win'
|
||||
BITNESS = '64'
|
||||
description = 'Build the 64-bit windows calibre installer'
|
||||
|
||||
|
||||
class OSX(BuildInstaller):
|
||||
OS = 'osx'
|
||||
|
||||
|
||||
class Linux(BuildInstallers):
|
||||
OS = 'linux'
|
||||
|
||||
|
||||
class Win(BuildInstallers):
|
||||
OS = 'win'
|
||||
|
Loading…
x
Reference in New Issue
Block a user