Skip to content

Commit d84cdbf

Browse files
committed
Merged revisions 4552-4564 via svnmerge from
https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython ........ r4552 | pjenvey | 2008-06-07 15:56:15 -0400 (Sat, 07 Jun 2008) | 1 line whitespace ........ r4553 | pjenvey | 2008-06-07 17:15:31 -0400 (Sat, 07 Jun 2008) | 7 lines o have ant generate the version information into a prop file, which is loaded by a Version class. includes the svn revision when it can get it (unix platforms) o support sys.subversion, including the branch info (not always the revision) o utilize the build info in sys.version and in a CPythonish banner. hardcode the copyright banner, now includes "help" ........ r4554 | pjenvey | 2008-06-07 18:23:00 -0400 (Sat, 07 Jun 2008) | 4 lines match class AttributeError messages to CPython fixes #1039 thanks lsoto ........ r4555 | pjenvey | 2008-06-07 18:38:12 -0400 (Sat, 07 Jun 2008) | 4 lines fix derived __getitem__ swallowing custom LookupErrors fixes #1038 patch by lsoto ........ r4556 | pjenvey | 2008-06-07 18:51:14 -0400 (Sat, 07 Jun 2008) | 3 lines latest template updates. re-enable the random derived template as it hasn't been updated in a while ........ r4557 | pjenvey | 2008-06-07 18:58:19 -0400 (Sat, 07 Jun 2008) | 1 line not everyone's ant is supporting propertyfile out of the box, use echo instead ........ r4558 | pjenvey | 2008-06-07 19:04:34 -0400 (Sat, 07 Jun 2008) | 1 line woops, ensure the dir first. thanks Ariane ........ r4559 | pjenvey | 2008-06-07 20:58:39 -0400 (Sat, 07 Jun 2008) | 2 lines fix thread.exit from other threads exiting the Jython process ........ r4560 | pjenvey | 2008-06-07 21:01:51 -0400 (Sat, 07 Jun 2008) | 1 line update the ticket referencing why this is disabled ........ r4561 | pjenvey | 2008-06-07 21:20:26 -0400 (Sat, 07 Jun 2008) | 2 lines site.py from: http://svn.python.org/projects/python/branches/release23-maint/Lib/site.py@35472 ........ r4562 | pjenvey | 2008-06-07 21:21:23 -0400 (Sat, 07 Jun 2008) | 1 line special case jython for a Lib/site-packages sitedir ........ r4563 | pjenvey | 2008-06-07 22:13:16 -0400 (Sat, 07 Jun 2008) | 1 line support -? for help ........ r4564 | pjenvey | 2008-06-07 23:00:45 -0400 (Sat, 07 Jun 2008) | 2 lines have BaseSet implement Set. not sure why this was commented out fixes #1009477 ........
1 parent 9a5f22c commit d84cdbf

42 files changed

Lines changed: 1576 additions & 228 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Lib/site.py

Lines changed: 424 additions & 0 deletions
Large diffs are not rendered by default.

Lib/test/test_class_jy.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,27 @@ def hello(self):
121121
self.assert_(hasattr(Bar, 'hello'))
122122
self.assertEquals(Bar().hello(), 'hello')
123123

124+
def test_attribute_error_message(self):
125+
# Ensure that AttributeError matches the CPython message
126+
class Bar:
127+
pass
128+
try:
129+
Bar.bar
130+
self._assert(False) # The previous line should have raised
131+
# AttributeError
132+
except AttributeError, e:
133+
self.assertEqual("class Bar has no attribute 'bar'", str(e))
134+
135+
class Foo(object):
136+
pass
137+
try:
138+
Foo.bar
139+
self._assert(False) # The previous line should have raised
140+
# AttributeError
141+
except AttributeError, e:
142+
self.assertEqual("type object 'Foo' has no attribute 'bar'",
143+
str(e))
144+
124145

125146
class ClassNamelessModuleTestCase(unittest.TestCase):
126147

Lib/test/test_dict_jy.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,19 @@ def __setitem__(self, key, value):
2323
s[7] = 'called'
2424
self.assertEquals('called', s.createdInInit)
2525

26+
class DerivedDictTest(unittest.TestCase):
27+
"Tests for derived dict behaviour"
28+
def test_raising_custom_key_error(self):
29+
class CustomKeyError(KeyError):
30+
pass
31+
class DerivedDict(dict):
32+
def __getitem__(self, key):
33+
raise CustomKeyError("custom message")
34+
self.assertRaises(CustomKeyError, lambda: DerivedDict()['foo'])
35+
36+
2637
def test_main():
27-
test_support.run_unittest(DictInitTest)
38+
test_support.run_unittest(DictInitTest, DerivedDictTest)
2839

2940
if __name__ == '__main__':
3041
test_main()

Lib/test/test_socket_ssl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def test_basic():
2828
f.close()
2929

3030
def test_rude_shutdown():
31-
if test_support.is_jython:#see http://jython.org/bugs/1754222
31+
# This test deadlocks, see http://bugs.jython.org/issue1049
32+
if test_support.is_jython:
3233
return
3334
try:
3435
import thread

build.xml

Lines changed: 86 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ oracle.jar=C:/workspace/HEAD/for_development/bisdevsrv28/jboss/server/infra/lib/
9393
# - the revision; only needed for a snapshot full-build
9494
# To create a snapshot build: uncomment and indicate the correct revision (it has to be a number)
9595
# For 'normal' builds, this defaults to the latest revision on svn.main.dir (HEAD)
96-
#svn.revision=3444
96+
#snapshot.revision=3444
9797

9898
# - the directory containing libsvnjavahl-1.dll (on windows) and svnjavahl.jar; only needed for full-build
9999
# how to get these (for windows):
@@ -126,10 +126,7 @@ svnant.jar.dir=${basedir}/../externals/svnant-jars
126126

127127
<target name="full-build" depends="full-check, install" description="a full build with svn checkout" />
128128

129-
<target name="init">
130-
<property file="${user.home}/ant.properties" />
131-
<property file="${basedir}/ant.properties" />
132-
129+
<target name="init" depends="version-init">
133130
<property name="build.compiler" value="modern" />
134131
<property name="jdk.target.version" value="1.5" />
135132
<property name="jdk.source.version" value="1.5" />
@@ -193,6 +190,33 @@ svnant.jar.dir=${basedir}/../externals/svnant-jars
193190
</uptodate>
194191
</target>
195192

193+
<target name="version-init">
194+
<property file="${user.home}/ant.properties" />
195+
<property file="${basedir}/ant.properties" />
196+
197+
<property name="PY_RELEASE_LEVEL_ALPHA" value="10"/> <!-- 0xA -->
198+
<property name="PY_RELEASE_LEVEL_BETA" value="11"/> <!-- 0xB -->
199+
<property name="PY_RELEASE_LEVEL_GAMMA" value="12"/> <!-- 0xC -->
200+
<property name="PY_RELEASE_LEVEL_FINAL" value="15"/> <!-- 0xF -->
201+
<property name="PY_RELEASE_LEVEL_SNAPSHOT" value="170"/> <!-- 0xAA -->
202+
203+
<!-- The current version info -->
204+
<property name="jython.version" value="2.3a0+" />
205+
<property name="jython.major_version" value="2"/>
206+
<property name="jython.minor_version" value="3"/>
207+
<property name="jython.micro_version" value="0"/>
208+
<property name="jython.release_level" value="${PY_RELEASE_LEVEL_ALPHA}"/>
209+
<property name="jython.release_serial" value="0"/>
210+
211+
<condition property="do.snapshot.build">
212+
<isset property="snapshot.revision" />
213+
</condition>
214+
<!-- Switch to a snapshot release_level when appropriate -->
215+
<condition property="jython.real_release_level" value="${PY_RELEASE_LEVEL_SNAPSHOT}" else="${jython.release_level}">
216+
<isset property="do.snapshot.build" />
217+
</condition>
218+
</target>
219+
196220
<target name="full-preinit">
197221
<property file="${user.home}/ant.properties" />
198222
<property file="${basedir}/ant.properties" />
@@ -213,17 +237,7 @@ svnant.jar.dir=${basedir}/../externals/svnant-jars
213237
<condition property="do.checkout" value="true">
214238
<istrue value="${has.repositories.connection}" />
215239
</condition>
216-
<condition property="do.snapshot.build">
217-
<isset property="svn.revision" />
218-
</condition>
219-
<condition property="jython.version" value="${svn.revision}">
220-
<isset property="svn.revision" />
221-
</condition>
222-
<property name="jython.version" value="2.3a0" />
223-
<!-- if not set so far, default svn.revision to HEAD, since we always want
224-
the latest revision on the specified subversion main directory -->
225-
<property name="svn.revision" value="HEAD"/>
226-
240+
227241
<!-- classpath for svn ant task -->
228242
<path id="svn.classpath">
229243
<pathelement path="${java.class.path}" />
@@ -275,6 +289,7 @@ svnant.jar.dir=${basedir}/../externals/svnant-jars
275289
<echo>javahl.dir = '${javahl.dir}'</echo>
276290
<echo>svnant.jar.dir = '${svnant.jar.dir}'</echo>
277291
<echo>do.snapshot.build = '${do.snapshot.build}'</echo>
292+
<echo>snapshot.revision = '${snapshot.revision}'</echo>
278293
<echo>do.checkout = '${do.checkout}'</echo>
279294
</target>
280295

@@ -330,8 +345,8 @@ svnant.jar.dir=${basedir}/../externals/svnant-jars
330345

331346
<target name="checkout" depends="prepare" if="do.checkout">
332347
<svn javahl="${javahl.dir}" >
333-
<checkout url="https://jython.svn.sourceforge.net/svnroot/jython/${svn.main.dir}/jython" revision="${svn.revision}" destPath="${svn.checkout.dir}/jython" />
334-
<checkout url="https://jython.svn.sourceforge.net/svnroot/jython/${svn.main.dir}/installer" revision="${svn.revision}" destPath="${svn.checkout.dir}/installer" />
348+
<checkout url="https://jython.svn.sourceforge.net/svnroot/jython/${svn.main.dir}/jython" revision="${snapshot.revision}" destPath="${svn.checkout.dir}/jython" />
349+
<checkout url="https://jython.svn.sourceforge.net/svnroot/jython/${svn.main.dir}/installer" revision="${snapshot.revision}" destPath="${svn.checkout.dir}/installer" />
335350
</svn>
336351

337352
<!-- checkout cpython license from the correct python maintenance branch -->
@@ -340,31 +355,64 @@ svnant.jar.dir=${basedir}/../externals/svnant-jars
340355
</svn>
341356
</target>
342357

343-
344-
<!-- change the version string, if so defined: used for snapshot builds -->
345-
<!-- the following replacements have to be updated if the version strings
346-
in PySystemState.java and README.txt change -->
347-
<target name="version" depends="checkout" if="do.snapshot.build" >
348-
<property name="replace.value.version" value='version = "2.2b${svn.revision}"' />
349-
<replace file="${source.dir}/org/python/core/PySystemState.java" token='version = "2.2b2"' value="${replace.value.version}" />
350-
<replace file="${source.dir}/org/python/core/PySystemState.java" token="PY_RELEASE_LEVEL = 0x0A" value="PY_RELEASE_LEVEL = 0xAA" />
351-
<property name="replace.value.serial" value="PY_RELEASE_SERIAL = ${svn.revision}" />
352-
<replace file="${source.dir}/org/python/core/PySystemState.java" token="PY_RELEASE_SERIAL = 2" value="${replace.value.serial}" />
358+
<target name="brand-version" depends="version-init">
359+
<tstamp>
360+
<format property="build.date" pattern="MMM d yyyy" offset="0"/>
361+
<format property="build.time" pattern="HH:mm:ss" offset="0"/>
362+
</tstamp>
363+
<exec executable="svnversion" osfamily="unix" outputproperty="build.svn.revision"/>
364+
<!-- XXX: could attempt to utilize subwcrev.exe to get the revision on Windows -->
365+
<condition property="build.svn.revision" value="">
366+
<not>
367+
<os family="unix"/>
368+
</not>
369+
</condition>
370+
<property name="version.properties" value="${compile.dir}/org/python/version.properties"/>
371+
<mkdir dir="${compile.dir}/org/python"/>
372+
<echo file="${version.properties}"># Jython version information
373+
jython.version=${jython.version}
374+
jython.major_version=${jython.major_version}
375+
jython.minor_version=${jython.minor_version}
376+
jython.micro_version=${jython.micro_version}
377+
jython.release_level=${jython.release_level}
378+
jython.release_serial=${jython.release_serial}
379+
jython.build.date=${build.date}
380+
jython.build.time=${build.time}
381+
jython.build.svn_revision=${build.svn.revision}</echo>
382+
<!--
383+
<touch file="${version.properties}" mkdirs="true"/>
384+
<propertyfile file="${version.properties}"
385+
comment="Jython version information">
386+
<entry key="jython.version" value="${jython.version}"/>
387+
<entry key="jython.major_version" value="${jython.major_version}"/>
388+
<entry key="jython.minor_version" value="${jython.minor_version}"/>
389+
<entry key="jython.micro_version" value="${jython.micro_version}"/>
390+
<entry key="jython.release_level" value="${jython.real_release_level}"/>
391+
<entry key="jython.release_serial" value="${jython.release_serial}"/>
392+
<entry key="jython.build.date" type="date" value="now" pattern="MMM d yyyy"/>
393+
<entry key="jython.build.time" type="date" value="now" pattern="HH:mm:ss"/>
394+
<entry key="jython.build.svn_revision" value="${build.svn.revision}"/>
395+
</propertyfile>
396+
-->
397+
</target>
353398

354-
<!-- change README.txt -->
355-
<replace file="${jython.base.dir}/README.txt" token='2.2b2' value='2.2b${svn.revision}' />
356-
<replace file="${jython.base.dir}/README.txt">
357-
<replacetoken>=======================</replacetoken>
358-
<replacevalue>--------------------------
399+
<target name="brand-readme-version" depends="checkout" if="do.snapshot.build">
400+
<!-- change README.txt version string, if so defined: used for
401+
snapshot builds. XXX: a bit broken for now-->
402+
<replace file="${jython.base.dir}/README.txt" token='2.2b2'
403+
value='2.2b${snapshot.revision}' />
404+
<replace file="${jython.base.dir}/README.txt">
405+
<replacetoken>=======================</replacetoken>
406+
<replacevalue>--------------------------
359407

360408
This is a snapshot build.
361409
It reflects the current development status.
362410

363411
The readme text for the next release will be like:
364412

365-
</replacevalue>
366-
</replace>
367-
</target>
413+
</replacevalue>
414+
</replace>
415+
</target>
368416

369417
<!-- separate build.xml for parser grammar -->
370418
<!-- we use settings as in developer-build - at the moment all properties will already be set if we do a full build -->
@@ -416,7 +464,7 @@ The readme text for the next release will be like:
416464

417465
</target>
418466

419-
<target name="compile" depends="init,antlr_gen,jarjar">
467+
<target name="compile" depends="init,antlr_gen,jarjar,brand-version">
420468
<javac destdir="${compile.dir}"
421469
target="${jdk.target.version}"
422470
source="${jdk.source.version}"
@@ -627,7 +675,7 @@ The readme text for the next release will be like:
627675
</target>
628676

629677
<!-- wrap the build into the installer -->
630-
<target name="install" depends="version, doc, jar, javadoc, copy-full">
678+
<target name="install" depends="brand-readme-version, doc, jar, javadoc, copy-full">
631679
<property name="install.src.dir" value="${jython.base.dir}/../installer/src/java" />
632680
<echo>compiling installer from ${install.src.dir}</echo>
633681
<javac srcdir="${install.src.dir}"

0 commit comments

Comments
 (0)