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
|
*.so
|
||||||
.build-cache
|
*.pyc
|
||||||
|
*.pyo
|
||||||
tags
|
tags
|
||||||
build
|
build
|
||||||
linux-package
|
linux-package
|
||||||
@ -9,3 +8,4 @@ logo/*.iconset
|
|||||||
test-launcher
|
test-launcher
|
||||||
kitty-profile
|
kitty-profile
|
||||||
dev
|
dev
|
||||||
|
__pycache__
|
||||||
|
|||||||
3
Makefile
3
Makefile
@ -3,3 +3,6 @@ all:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
python3 setup.py test
|
python3 setup.py test
|
||||||
|
|
||||||
|
clean:
|
||||||
|
python3 setup.py clean
|
||||||
|
|||||||
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',
|
'action',
|
||||||
nargs='?',
|
nargs='?',
|
||||||
default='build',
|
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)'
|
help='Action to perform (default is build)'
|
||||||
)
|
)
|
||||||
p.add_argument(
|
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():
|
def main():
|
||||||
if sys.version_info < (3, 5):
|
if sys.version_info < (3, 5):
|
||||||
raise SystemExit('python >= 3.5 required')
|
raise SystemExit('python >= 3.5 required')
|
||||||
@ -447,6 +456,8 @@ def main():
|
|||||||
elif args.action == 'osx-bundle':
|
elif args.action == 'osx-bundle':
|
||||||
build(args, native_optimizations=False)
|
build(args, native_optimizations=False)
|
||||||
package(args, for_bundle=True)
|
package(args, for_bundle=True)
|
||||||
|
elif args.action == 'clean':
|
||||||
|
clean()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user