Add a clean action to setup.py
This commit is contained in:
parent
66803e6873
commit
25913f77e0
6
.gitignore
vendored
6
.gitignore
vendored
@ -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__
|
||||
|
||||
BIN
logo/kitty.png
BIN
logo/kitty.png
Binary file not shown.
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.2 KiB |
13
setup.py
13
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__':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user