Fix incremental compilation
The macOS specific `package()` code changes the directory. This didn't cause any problems before 9135387cfa141e9ec27271bc41d5b6c43da90197 since `compile_commands.json` was written to the filesystem before `package()` was called. This is not the case anymore, which results in `compile_commands.json` being written into the `kitty.app` bundle. I fixed the problem by using a context manager to change the direcctory back after `kitty.app` was created.
This commit is contained in:
parent
bc90ce569a
commit
aaaf7f9d8b
14
setup.py
14
setup.py
@ -669,6 +669,18 @@ def compile_python(base_path):
|
|||||||
compileall.compile_dir(base_path, **kwargs)
|
compileall.compile_dir(base_path, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class ChDir(object):
|
||||||
|
def __init__(self, path):
|
||||||
|
self.old_dir = os.getcwd()
|
||||||
|
self.new_dir = path
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
os.chdir(self.new_dir)
|
||||||
|
|
||||||
|
def __exit__(self, *args):
|
||||||
|
os.chdir(self.old_dir)
|
||||||
|
|
||||||
|
|
||||||
def package(args, bundle_type):
|
def package(args, bundle_type):
|
||||||
ddir = args.prefix
|
ddir = args.prefix
|
||||||
if bundle_type == 'linux-freeze':
|
if bundle_type == 'linux-freeze':
|
||||||
@ -741,7 +753,7 @@ Categories=System;TerminalEmulator;
|
|||||||
if bundle_type.startswith('macos-'): # macOS bundle gunk {{{
|
if bundle_type.startswith('macos-'): # macOS bundle gunk {{{
|
||||||
import plistlib
|
import plistlib
|
||||||
logo_dir = os.path.abspath(os.path.join('logo', appname + '.iconset'))
|
logo_dir = os.path.abspath(os.path.join('logo', appname + '.iconset'))
|
||||||
os.chdir(ddir)
|
with ChDir(ddir):
|
||||||
os.mkdir('Contents')
|
os.mkdir('Contents')
|
||||||
os.chdir('Contents')
|
os.chdir('Contents')
|
||||||
VERSION = '.'.join(map(str, version))
|
VERSION = '.'.join(map(str, version))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user