On Tue, Aug 2, 2011 at 4:37 PM, Vladimir Perić <[email protected]> wrote:
> Hello,
>
> per the discussion on [1], it was decided to support Python 3 with a
> script that will copy non-mpmath code to a different directory
> ("sympy-py3k"), run 2to3 on it, then copy the mpmath stuff over. I
> implemented such a script with this commit[2] (if the commit gets
> rebased away, it's in my porting4 branch). It simply traverses the
> code and copies everything other than some dirs (.git, my/, mpmath/
> and others); Ronan suggested scraping .gitignore for this info. If it
> deems a file should be copied over (checking the mtime to try and not
> do this every time) it adds it to a list of files to call 2to3 on.
> After all relevant files are copied, 2to3 is run and then mpmath is
> copied over (regardless of whether it changed or not). All in all, a
> relatively simple script (the source might be cleaner than this
> explanation).
>
> Now, Aaron pointed out that this is a problem because it copies over
> everything not explicitly ignored. He was worried about some rogue
> script crashing 2to3, but there's also the danger of copying over
> large files the user might have hanging around [*]. He suggested
> getting around this by relying on the output of "git ls-files". This
> is generally a cleaner approach (wish I had thought of it), as we skip
> traversing our dirs and only copy over relevant files. The downside is
> that the use2to3 script will then depend on the presence of the git
> repo. It removes the usecase: "I downloaded py2 code, but I decided I
> want it in Python 3 anyway. Why can't I just run the use2to3 script
> the developers use if I have it already?". I'm not sure how likely
> this particular case is going to crop up, but it seems possible. And,
> we will also be depending on git.
>
> So, should we:
>
> a) continue with the script I have currently (perhaps with a big fat
> warning "I hope you don't have any large files around." in some way
>
> b) refactor to use "git ls-files", disregarding the above mentioned
> usecase and relying on git for this script to work
>
> c) something else?

Option c is to explicitly list all the files that you want to copy in
the script.

>
> Thanks for any comments.
>
> [1] http://code.google.com/p/sympy/issues/detail?id=2482
> [2] 
> https://github.com/vperic/sympy/commit/1e492f90e93811a9ff27d5eb152bcd1c112f7223
>
> [*] We want to copy everything so the user could just "cd sympy-py3k"
> and use SymPy under Python 3 from there seamlessly. The code that
> needs 2to3 is spread around sympy/, doc/, examples/, bin/ and ./
> (root), so copying everything is the cleanest solution IMHO.
> --
> Vladimir Perić
>

So does 2to3 correctly skip non-Python files, or is this something
that would have to be dealt with?

If so, we could use git ls-files, and if that doesn't work (because
for example git is not installed or the repo is not really a git
checkout), just copy *everything* (printing a warning).  That way, we
use the intelligent solution with git, but there is still a fall back.

Aaron Meurer

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" 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/sympy?hl=en.

Reply via email to