Skip to contentSkip to conversation

tools/python: Improve .gitgnore and clean Makefile rule

PATCH In review Andrew Cooper 2 participants 5 messages Jul 7, 2014 – Jul 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools/python: Improve .gitgnore and clean Makefile rule

Ignore all intermediate python files, and use find in the clean rule as there are no Makefiles in subdirectories to participate in a recursive clean.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>

--
v2: Actually send the latest version of the patch

---
 .gitignore            |    1 +
 tools/python/Makefile |    8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)
.gitignore +1 -0
index 562c262..cf9264f 100644
@@ -16,6 +16,7 @@
 *.spit
 *.gcno
 *.gcda
+*.py[ocd]
 TAGS
 GTAGS
 GRTAGS
tools/python/Makefile +3 -5
index eee746d..c914332 100644
@@ -29,10 +29,8 @@ test:
 
 .PHONY: clean
 clean:
-	rm -f $(XENPATH)
-	rm -rf build/ *.pyc *.pyo *.o *.a *~ xen/util/auxbin.pyc
-	rm -f xen/lowlevel/xl/_pyxl_types.h
-	rm -f xen/lowlevel/xl/_pyxl_types.c
-	rm -f $(DEPS)
+	find . \( -name "*.py[ocd]" -o -name "*~" -o -name "_*.[hc]" \) -delete
+	rm -rf build/
+	rm -f $(XENPATH) $(DEPS)
 
 -include $(DEPS)
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 12 lines · Andrew Cooper

Ignore all intermediate python files, and use find in the clean rule as there are no Makefiles in subdirectories to participate in a recursive clean.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
.gitignore +0 -0
index 562c262..cf9264f 100644

.gitignore line 19

Quoted 4 lines
.gitignore +1 -0
@@ -16,6 +16,7 @@
 *.spit
 *.gcno
 *.gcda
+*.py[ocd]

FWIW there are a bunch of explicit foo.pyc listed which could now be removed I guess.

.gitignore

Quoted 6 lines
.gitignore +1 -5
-	rm -f $(XENPATH)
-	rm -rf build/ *.pyc *.pyo *.o *.a *~ xen/util/auxbin.pyc
-	rm -f xen/lowlevel/xl/_pyxl_types.h
-	rm -f xen/lowlevel/xl/_pyxl_types.c
-	rm -f $(DEPS)
+	find . \( -name "*.py[ocd]" -o -name "*~" -o -name "_*.[hc]" \) -delete

I've assumed the lack of *.a in here is deliberate but *.o?

Ian.

#2 lore raw
Quoted 4 lines · Ian Campbell
Quoted 3 lines · Andrew Cooper

Ignore all intermediate python files, and use find in the clean rule as there are no Makefiles in subdirectories to participate in a recursive clean.

Quoted 14 lines

.gitignore line 19

Quoted 12 lines
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
.gitignore +1 -0
index 562c262..cf9264f 100644
@@ -16,6 +16,7 @@
 *.spit
 *.gcno
 *.gcda
+*.py[ocd]

FWIW there are a bunch of explicit foo.pyc listed which could now be removed I guess.

True.

Quoted 11 lines

.gitignore

Quoted 7 lines
.gitignore +1 -5
-	rm -f $(XENPATH)
-	rm -rf build/ *.pyc *.pyo *.o *.a *~ xen/util/auxbin.pyc
-	rm -f xen/lowlevel/xl/_pyxl_types.h
-	rm -f xen/lowlevel/xl/_pyxl_types.c
-	rm -f $(DEPS)
+	find . \( -name "*.py[ocd]" -o -name "*~" -o -name "_*.[hc]" \) -delete

I've assumed the lack of *.a in here is deliberate but *.o?

Ian.

No object files or libraries will be generated outside of build/

If we wish to cater to devs doing out-of-band builds in subdirectires then more than .o and .a should be included in this find.

~Andrew

#3 lore raw
Quoted 31 lines · Andrew Cooper
Quoted 4 lines · Ian Campbell
Quoted 3 lines · Andrew Cooper

Ignore all intermediate python files, and use find in the clean rule as there are no Makefiles in subdirectories to participate in a recursive clean.

Quoted 14 lines

.gitignore line 19

Quoted 12 lines
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
.gitignore +1 -0
index 562c262..cf9264f 100644
@@ -16,6 +16,7 @@
 *.spit
 *.gcno
 *.gcda
+*.py[ocd]

FWIW there are a bunch of explicit foo.pyc listed which could now be removed I guess.

True.

Quoted 9 lines

.gitignore

Quoted 7 lines
.gitignore +1 -5
-	rm -f $(XENPATH)
-	rm -rf build/ *.pyc *.pyo *.o *.a *~ xen/util/auxbin.pyc
-	rm -f xen/lowlevel/xl/_pyxl_types.h
-	rm -f xen/lowlevel/xl/_pyxl_types.c
-	rm -f $(DEPS)
+	find . \( -name "*.py[ocd]" -o -name "*~" -o -name "_*.[hc]" \) -delete

I've assumed the lack of *.a in here is deliberate but *.o?

Quoted 4 lines
Quoted 2 lines

Ian.

No object files or libraries will be generated outside of build/

Ah, right.

Quoted 2 lines

If we wish to cater to devs doing out-of-band builds in subdirectires then more than .o and .a should be included in this find.

no need: Acked-by: Ian Campbell <[email protected]>

#4 lore raw
Quoted 4 lines · Ian Campbell
Quoted 2 lines

If we wish to cater to devs doing out-of-band builds in subdirectires then more than .o and .a should be included in this find.

no need: Acked-by: Ian Campbell <[email protected]>

and applied, thanks.