Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#9595 closed defect (fixed)

Check the Python version on install

Reported by: hm2k Owned by: Remy Blank
Priority: high Milestone: 0.12.2
Component: admin/console Version: 0.13dev
Severity: critical Keywords: python3
Cc:
Release Notes:
API Changes:

Description

[root@vps112 ~]# trac-admin
Traceback (most recent call last):
  File "/usr/bin/trac-admin", line 7, in ?
    sys.exit(
  File "/usr/lib/python2.3/site-packages/setuptools-0.6c11-py2.3.egg/pkg_resources.py", line 318, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.3/site-packages/setuptools-0.6c11-py2.3.egg/pkg_resources.py", line 2221, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.3/site-packages/setuptools-0.6c11-py2.3.egg/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "build/bdist.linux-i686/egg/trac/admin/__init__.py", line 14, in ?
  File "/usr/lib/python2.3/site-packages/Trac-0.13dev_r10030-py2.3.egg/trac/admin/api.py", line 140
    return list(set(a for a in self if a.startswith(text)))
                        ^
SyntaxError: invalid syntax

Attachments (0)

Change History (14)

comment:1 Changed 8 years ago by Christian Boos

Resolution: invalid
Status: newclosed

You're using Python 2.3, which is not supported anymore starting with Trac 0.12.

And with Trac 0.13dev, you'll even need Python 2.5.

See TracInstall and 0.13/TracInstall.

comment:2 Changed 8 years ago by hm2k

You mean there's no testing to check for the required version?

That seems silly to me.

comment:3 in reply to:  2 Changed 8 years ago by Remy Blank

Replying to hm2k:

You mean there's no testing to check for the required version?

You have a point there. We should probably add a check to setup.py.

comment:4 Changed 8 years ago by hm2k

Yes, a check would be useful. I'd hope this has been implemented by now.

With regards to this, I decided the only thing to do was to upgrade the system from CentOS 4 to CentOS 5, only to find that Python is only 2.4:

[root@vps112 ~]# rpm -q python
python-2.4.3-27.el5_5.3

The reason for this is probably due to backporting: http://tinyurl.com/r77l2

It's official: I'm unable to setup/install Trac on CentOS. Am I overlooking something here?

Can anyone advise further?

comment:5 Changed 8 years ago by Remy Blank

Milestone: 0.12.2
Resolution: invalid
Status: closedreopened
Summary: SyntaxError: invalid syntaxCheck the Python version on install

Install 0.12.1 or from the 0.12-stable branch, which support Python 2.4.

I'll add the version check.

comment:6 Changed 8 years ago by Remy Blank

Resolution: fixed
Status: reopenedclosed

Version check added in [10364].

comment:7 Changed 8 years ago by Remy Blank

Owner: set to Remy Blank

comment:8 Changed 5 years ago by Peter Suter

Apparently this still raises a syntax error in Python 3:

File "c:... \setuptools-0.9.8-py3.3.egg\setuptools\sandbox.py", line 71 in <lambda>
File "c:... \setuptools-0.9.8-py3.3.egg\setuptoools\compat.p", line 92 in execfile
File "setup.py", line 21  print "Trac requires Python %d.%d or later" % min_python
SyntaxError: invalid syntax

Adding parentheses to all three print statements in that file might make the file "Python 3 compatible enough" to print the nicer error message. (I have not yet confirmed this though.)

comment:9 Changed 5 years ago by Ryan J Ollos

I tested out your suggestion, and Trac doesn't support Python 3 (yet) is printed after adding parenthesis to all 3 print statements in setup.py. Tested with Python 3.3.1, 1.0-stable on Ubuntu 13.04.

  • setup.py

    diff --git a/setup.py b/setup.py
    index fac56c1..3cb508b 100755
    a b from setuptools import setup, find_packages  
    1818
    1919min_python = (2, 5)
    2020if sys.version_info < min_python:
    21     print "Trac requires Python %d.%d or later" % min_python
     21    print("Trac requires Python %d.%d or later" % min_python)
    2222    sys.exit(1)
    2323if sys.version_info >= (3,):
    24     print "Trac doesn't support Python 3 (yet)"
     24    print("Trac doesn't support Python 3 (yet)")
    2525    sys.exit(1)
    2626
    2727extra = {}
    except ImportError:  
    4949try:
    5050    import genshi
    5151except ImportError:
    52     print "Genshi is needed by Trac setup, pre-installing"
     52    print("Genshi is needed by Trac setup, pre-installing")
    5353    # give some context to the warnings we might get when installing Genshi

Let me know if that looks good to you and I'm happy to push the change.

Last edited 5 years ago by Ryan J Ollos (previous) (diff)

comment:10 Changed 5 years ago by Peter Suter

Thanks for testing! Looks good to me.

comment:11 Changed 5 years ago by Peter Suter

Cc: python3 added

(For reference: #10083 is about real Python 3 support.)

comment:12 Changed 5 years ago by Ryan J Ollos

Cc: python3 removed
Keywords: python3 added

Assuming you meant to add this to Keywords, and I find myself putting keywords in the Cc field fairly often. I see other people on my dev team do it as well, so it might be something we want to address eventually.

comment:13 Changed 5 years ago by Peter Suter

Oops, yes. Thanks for fixing. (Apparently I'm more used to a different number and distribution of fields.)

comment:14 Changed 5 years ago by Ryan J Ollos

Also tested with 1.0-stable and Python 2.5, 2.6 and 2.7; 0.12-stable and Python 2.4 (on Ubuntu 13.04).

Committed to 0.12-stable in [11936], merged to 1.0-stable in [11937] and merged to trunk in [11938]. Thanks Peter!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.