diff --git a/.gitignore b/.gitignore index c603c0186..fc236403b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ -*.js -*.pyj-cached *.so -.build-cache +*.pyc +*.pyo tags build linux-package @@ -9,3 +8,4 @@ logo/*.iconset test-launcher kitty-profile dev +__pycache__ diff --git a/Makefile b/Makefile index 28e6c02b5..f2a0d85cd 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,6 @@ all: test: python3 setup.py test + +clean: + python3 setup.py clean diff --git a/logo/kitty.png b/logo/kitty.png index f7e5ed08f..9a48e0a14 100644 Binary files a/logo/kitty.png and b/logo/kitty.png differ diff --git a/setup.py b/setup.py index 65a022974..f86858350 100755 --- a/setup.py +++ b/setup.py @@ -264,7 +264,7 @@ def option_parser(): 'action', nargs='?', default='build', - choices='build test linux-package osx-bundle'.split(), + choices='build test linux-package osx-bundle clean'.split(), help='Action to perform (default is build)' ) p.add_argument( @@ -425,6 +425,15 @@ Categories=System; # }}} +def clean(): + for f in subprocess.check_output('git ls-files --others --ignored --exclude-from=.gitignore'.split()).decode('utf-8').splitlines(): + if f.startswith('logo/kitty.iconset') or f.startswith('dev/'): + continue + os.unlink(f) + if os.sep in f and not os.listdir(os.path.dirname(f)): + os.rmdir(os.path.dirname(f)) + + def main(): if sys.version_info < (3, 5): raise SystemExit('python >= 3.5 required') @@ -447,6 +456,8 @@ def main(): elif args.action == 'osx-bundle': build(args, native_optimizations=False) package(args, for_bundle=True) + elif args.action == 'clean': + clean() if __name__ == '__main__':