mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
libmtp: make update script run on python3
Also make it not clone tons of useless history.
This commit is contained in:
parent
6aa1592052
commit
9ad1ebf487
8
src/calibre/devices/mtp/unix/upstream/update.py
Normal file → Executable file
8
src/calibre/devices/mtp/unix/upstream/update.py
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python3
|
||||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
|
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
|
||||||
from __future__ import (unicode_literals, division, absolute_import,
|
from __future__ import (unicode_literals, division, absolute_import,
|
||||||
print_function)
|
print_function)
|
||||||
@ -14,9 +14,7 @@ base = os.path.dirname(os.path.abspath(__file__))
|
|||||||
os.chdir('/tmp')
|
os.chdir('/tmp')
|
||||||
if os.path.exists('libmtp'):
|
if os.path.exists('libmtp'):
|
||||||
shutil.rmtree('libmtp')
|
shutil.rmtree('libmtp')
|
||||||
subprocess.check_call(['git', 'clone', 'git://git.code.sf.net/p/libmtp/code',
|
subprocess.check_call(['git', 'clone', '--depth=1', 'git://git.code.sf.net/p/libmtp/code',
|
||||||
'libmtp'])
|
'libmtp'])
|
||||||
for x in ('src/music-players.h', 'src/device-flags.h'):
|
for x in ('src/music-players.h', 'src/device-flags.h'):
|
||||||
with open(os.path.join(base, os.path.basename(x)), 'wb') as f:
|
shutil.copyfile('libmtp/'+x, os.path.join(base, os.path.basename(x)))
|
||||||
shutil.copyfileobj(open('libmtp/'+x), f)
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user