Opened 12 years ago

Closed 12 years ago

#8316 closed enhancement (fixed)

Remove the Jinja (not Jinja2) package

Reported by: mpatel Owned by: tbd
Priority: minor Milestone: sage-4.5.3
Component: packages: standard Keywords:
Cc: AlexGhitza, cwitty, mhansen, robertwb, timdumol Merged in: sage-4.5.3.alpha0
Authors: Mitesh Patel Reviewers: Carl Witty
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

With #7249 merged, it now seems that no Sage component depends on the "slightly outdated version" of Jinja. If this is indeed true, we can remove jinja-*.spkg from the Sage distribution.

Of course, we'll keep the "awesome version", jinja2-*.spkg.

Attachments (7)

trac_8316-remove_jinja.patch (3.0 KB) - added by mpatel 12 years ago.
Use Jinja2 instead of Jinja. sage repo.
trac_8316-remove_jinja.2.patch (11.9 KB) - added by mpatel 12 years ago.
Use myself instead of self. Replaces previous.
deps (16.8 KB) - added by mpatel 12 years ago.
Updated spkg/standard/deps. Based on #8306.
deps.diff (1.3 KB) - added by mpatel 12 years ago.
Diff of spkg/standard/deps vs. #8306.
install (5.8 KB) - added by mpatel 12 years ago.
Updated spkg/install. Based on #8306.
install.diff (251 bytes) - added by mpatel 12 years ago.
Diff of spkg/install vs. #8306.
4.5.rc1-deps.diff (1.5 KB) - added by cwitty 12 years ago.
deps.diff rebased to 4.5.rc1

Download all attachments as: .zip

Change History (13)

comment:1 Changed 12 years ago by mpatel

  • Cc cwitty added

SageNB no longer depends on Jinja. The Sage library does:

$ cd SAGE_ROOT/devel/sage-main/sage
$ grep jinja `find -name \*.py\*` |grep import
./server/notebook/template.py:import jinja
./ext/gen_interpreters.py:from jinja import Environment
./ext/gen_interpreters.py:from jinja.datastructure import ComplainingUndefined

Changed 12 years ago by mpatel

Use Jinja2 instead of Jinja. sage repo.

Changed 12 years ago by mpatel

Use myself instead of self. Replaces previous.

comment:2 Changed 12 years ago by mpatel

To do: Update spkg/install and spkg/standard/deps. I'll wait for #8306.

Changed 12 years ago by mpatel

Updated spkg/standard/deps. Based on #8306.

Changed 12 years ago by mpatel

Diff of spkg/standard/deps vs. #8306.

Changed 12 years ago by mpatel

Updated spkg/install. Based on #8306.

Changed 12 years ago by mpatel

Diff of spkg/install vs. #8306.

comment:3 Changed 12 years ago by mpatel

  • Authors set to Mitesh Patel
  • Cc AlexGhitza mhansen robertwb timdumol added
  • Milestone set to sage-4.4.5
  • Priority changed from major to minor
  • Status changed from new to needs_review

With V1 of the patch, sage -b gives

[...]
Building interpreters for fast_callable
Traceback (most recent call last):
  File "setup.py", line 109, in <module>
    sage.ext.gen_interpreters.rebuild(SAGE_DEVEL + 'sage/sage/ext/interpreters')
  File "/mnt/usb1/scratch/mpatel/apps/sage-4.4.4.a0/devel/sage-main/sage/ext/gen_interpreters.py", line 3823, in rebuild
    build_interp(interp, dir)
  File "/mnt/usb1/scratch/mpatel/apps/sage-4.4.4.a0/devel/sage-main/sage/ext/gen_interpreters.py", line 3788, in build_interp
    interp = ig.get_interpreter()
  File "/mnt/usb1/scratch/mpatel/apps/sage-4.4.4.a0/devel/sage-main/sage/ext/gen_interpreters.py", line 3318, in get_interpreter
    self.write_interpreter(buff.write)
  File "/mnt/usb1/scratch/mpatel/apps/sage-4.4.4.a0/devel/sage-main/sage/ext/gen_interpreters.py", line 2974, in write_interpreter
    """, s=s, self=self, i=indent_lines))
  File "/mnt/usb1/scratch/mpatel/apps/sage-4.4.4.a0/devel/sage-main/sage/ext/gen_interpreters.py", line 177, in je
    return tmpl.render(kwargs)
  File "<template>", line 4, in top-level template code
  File "/home/mpatel/apps/sage/local/lib/python2.6/site-packages/Jinja2-2.1.1-py2.6-linux-x86_64.egg/jinja2/runtime.py", line 132, in call
    return __obj(*args, **kwargs)
  File "/home/mpatel/apps/sage/local/lib/python2.6/site-packages/Jinja2-2.1.1-py2.6-linux-x86_64.egg/jinja2/runtime.py", line 403, in _fail_with_undefined_error
    raise self._undefined_exception(hint)
jinja2.exceptions.UndefinedError: 'TemplateReference' object has no attribute 'func_header'
sage: There was an error installing modified sage library code.

The docstring for jinja2.runtime.TemplateReference is "The self in templates." But I'm not sure why this happens. Does Jinja2 not allow self=self?

V2 of the patch appears to be OK: sage -b works, Sage builds from scratch with SAGE_CHECK, the long tests pass. Did I miss any self --> myself conversions? Should I run some other tests?

I'm not familiar with ext/, so I've included some names from hg log gen_interpreters.py in the Cc: list.

comment:4 Changed 12 years ago by was

  • Milestone changed from sage-4.4.5 to sage-4.5

Milestone sage-4.4.5 deleted

Changed 12 years ago by cwitty

deps.diff rebased to 4.5.rc1

comment:5 Changed 12 years ago by cwitty

  • Reviewers set to Carl Witty
  • Status changed from needs_review to positive_review

Thanks for fixing up gen_interpreters.py, your changes look fine (and the template output from the patched gen_interpreters.py using jinja2 is byte-for-byte identical to the previous output using jinja).

I tested by starting from sage-4.5.rc1.tar, removing the jinja spkg, and applying install.diff and 4.5.rc1-deps.diff (the original deps.diff would no longer apply, so I rebased it). I then typed "make", waited for the build to fail, applied trac_8316-remove_jinja.2.patch, and restarted the build. The build was successfull, and all (long) tests passed.

Positive review.

comment:6 Changed 12 years ago by mpatel

  • Merged in set to sage-4.5.3.alpha0
  • Resolution set to fixed
  • Status changed from positive_review to closed

I'm merging

into 4.5.3.alpha0. Thanks for the review and rebasing the latter.

Note: See TracTickets for help on using tickets.