Opened 10 years ago

Closed 10 years ago

#12097 closed enhancement (fixed)

General clean-up of sage-make_relative

Reported by: jdemeyer Owned by: leif
Priority: major Milestone: sage-4.8
Component: scripts Keywords:
Cc: Merged in: sage-4.8.alpha3
Authors: Jeroen Demeyer Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

The attached patch essentially rewrites sage-make_relative. The new code is cleaner and simpler. It also changes files only once and only when needed. The previous version changed every Python file every time sage-make_relative was run.

Attachments (1)

12097_make_relative.patch (2.1 KB) - added by jdemeyer 10 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by jdemeyer

  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:3 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:4 Changed 10 years ago by vbraun

  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

Looks good!

Changed 10 years ago by jdemeyer

comment:5 Changed 10 years ago by jhpalmieri

After F.truncate(), should there also be a line F.close()? Or does the with clause automatically close F?

comment:6 Changed 10 years ago by vbraun

Yes! From http://docs.python.org/tutorial/inputoutput.html#methods-of-file-objects

sage: with open('/tmp/workfile', 'rw') as f:
....:     read_data = f.read()
....:     
sage: f.closed
True

comment:7 Changed 10 years ago by jdemeyer

  • Merged in set to sage-4.8.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.