#5977: [with patches, needs review and comments] Implement sage -clean-residues
-------------------------+--------------------------------------------------
Reporter: nthiery | Owner: mabshoff
Type: enhancement | Status: new
Priority: blocker | Milestone: sage-4.0
Component: build | Keywords: cleanup
-------------------------+--------------------------------------------------
Comment(by craigcitro):
I've attached a patch to clean the build tree. It's really two patches:
one for the `$SAGE_LOCAL/bin` repo, which has the actual functionality,
and another for the main repo.
The patch for the main repo simply removes two top-level imports of
`dsage` -- there are dsage files sitting in my build dir with no
corresponding files in the source tree; if something is simply wrong with
my build (actually, with both of the builds I checked), then I'm happy to
change this.
The code itself should be fairly readable, I think. I've written a little
script called `sage-sync-build`, which simply walks the `build` tree and
looks for files that don't have a corresponding file in the source tree.
If it finds any, it deletes them. After finishing each directory in
`build/`, it deletes the directory if it's now empty.
Mostly for testing purposes, I gave this three command-line arguments:
* `-p`: prune empty directories. (This is on by default, and passing `-p`
turns it off.)
* `-d`: dry run. If this is passed, simply mention what files it would
delete.
* `-v`: verbose. Print info about what it's doing.
NOTES:
* I tested this in my sage tree, and it seemed to work. Then I touched
some filenames in `sage/` or `build/` appropriately, and it '''seems''' to
do what I expect. However, if playing with the build system has taught me
anything, there are surely tons of cases that I didn't anticipate. I'm
happy to fix any bugs people run into.
* I tried to be careful about using `os.path.sep` and `os.path.extsep` to
compose the paths; I'm sure I slipped up somewhere. I've got a shiny
nickel for the first person to spot a slip-up ... `:)`
* I'm not wedded to any of the names, or the command-line arguments. I
made up `sync-build` after about 20 seconds of thought, so feel free to
say it's a silly name, and think of something better.
* One more vague comment: I feel like we '''should''' be able to make
distutils do this work for us. I spent about 5 minutes looking at
documentation and source, and didn't see anything, but my search was by no
means exhaustive. If anyone knows distutils better than I do, and has an
idea, just let me know. I'd like to get back to putting the caching of
dependencies back in place (#4651) soon, so I'll try and dig around more
then.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5977#comment:4>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---