Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 700738 - dev-java/ant-core-1.10.7 with >=dev-java/javatoolkit-0.6.1[python_targets_python2_7] - SyntaxError: Non-ASCII character '\xc2' in file /usr/lib/python-exec/python2.7/xml-rewrite-2.py on line 106, but no encoding declared
Summary: dev-java/ant-core-1.10.7 with >=dev-java/javatoolkit-0.6.1[python_targets_pyt...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 2 votes (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-20 00:28 UTC by Hank Leininger
Modified: 2020-09-25 09:18 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hank Leininger 2019-11-20 00:28:38 UTC
dev-java/ant-core will not compile for me with >=dev-java/javatoolkit-0.6.1:

 >>> Source unpacked in /var/tmp/portage/dev-java/ant-core-1.10.7/work
 >>> Preparing source in /var/tmp/portage/dev-java/ant-core-1.10.7/work/apache-ant-1.10.7 ...
 * Applying 1.10.7-build.patch ...    [ ok ]
 * Applying 1.10.7-launch.patch ...   [ ok ]
 * Adjusting to prefix /              [ ok ]
 *   ant ...                          [ ok ]
  File "/usr/lib/python-exec/python2.7/xml-rewrite-2.py", line 106
SyntaxError: Non-ASCII character '\xc2' in file /usr/lib/python-exec/python2.7/xml-rewrite-2.py on line 106, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
 * ERROR: dev-java/ant-core-1.10.7::gentoo failed (prepare phase):
 *   /usr/libexec/javatoolkit/xml-rewrite-2.py failed

/usr/lib/python-exec/python2.7/xml-rewrite-2.py is provided by dev-java/javatoolkit.  Line 106 indeed has a non-ascii, the copyright symbol:

        self.p('%s=%s ' % (a, quoteattr(v, {'©': '©'})))

If I downgrade javatoolkit to 0.3.0 (the only <0.6.1 in tree), building ant-core succeeds.  That version's xml-rewrite-2.py contains an identical line (but line 123 instead).  I think the difference is the switch to python3 in 0.6.x, but I am not certain.

This is on a system with LANG= , that is, not using en_US.UTF-8, but default POSIX.

There is a tracker for python3-javatoolkit bugs, https://bugs.gentoo.org/699102, but it appears unused.  I am not positive

That pep-0263 suggests adding a coding: comment header, for instance specifying unicode.  Naively poking one in gets past the original error but then causes the build to blow up elsewhere ("TypeError: unicode argument expected, got 'str'"), so it's not that simple.  Same error occurs if I replace the two binary bytes for the copyright symbol with "\xc2\xa9", or with b'\xc2\xa9' (and from this it may be apparent that I am a python noob).


Note that superficially, bugs https://bugs.gentoo.org/299805 and https://bugs.gentoo.org/627366 sound like they might be related, but I do not think they are (the errors reported there all look different).
Comment 1 Hank Leininger 2019-11-20 05:12:20 UTC
(In reply to Hank Leininger from comment #0)
> dev-java/ant-core will not compile for me with >=dev-java/javatoolkit-0.6.1:

dev-java/javatoolkit-0.6.2-r1 built only for python3 (USE=-python_targets_python2_7) can build dev-java/ant-core and dev-java/tomcat-servlet-api (which also errored before).

So unless someone wants to figure out how to fix the current version for python2, I would suggest removing python2_7 from javatoolkit-0.6.2-r1.ebuild's PYTHON_COMPAT.
Comment 2 charles17 2019-11-20 06:34:50 UTC
Please mark this a blocker of Bug 699102.  I cannot do changes here.
Comment 3 Paramonov Valeriy 2020-01-10 15:58:58 UTC
SOLVED: 

echo "dev-java/javatoolkit -python_targets_python2_7" >> /etc/portage/package.use/use
emerge -1v dev-java/javatoolkit

# resume update
emerge --resume
Comment 4 ad PC 2020-03-29 09:31:16 UTC
I can confirm the solution provided by @3.
Comment 5 John Covici 2020-04-05 20:49:09 UTC
This fix did not work for me, using dev-java/javatoolkit-0.6.2-r1 and trying to compile dev-java/ant-core-1.10.7-r1 .
Comment 6 Alex Barker 2020-04-07 21:04:06 UTC
I disabled python 2.7 system wide to fix the issue on my end.  There were no major issues except a few packages that just don't work with python 3, like mysql-workbench. These packages were all basically garbage anyway so I just removed them and moved on with my life. I seriously doubt this issue will be solved before python 2.7 is removed from the gentoo repo so sooner or later this will probably be the official fix.
Comment 7 Joshua Clayton 2020-04-11 03:22:20 UTC
The fix in comment 3 also worked for me.... originally I misunderstood and tried to diable python2 support for dev-java/ant-core, so I thought it had not worked.

That was months ago.

Reread and actually FOLLOWED the instructions today and ended a streak of almost 6 months of broken ant-core....  Makes me wonder if I really need a java sdk at all anymore I use it so rarely.
Comment 8 Georgy Yakovlev archtester gentoo-dev 2020-09-25 09:18:03 UTC
closing, as python2 target was removed from the package.