Source

jython / build.xml

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
<!-- Copyright 2000 Dj Walker-Morgan -->


<project name="jython" default="developer-build" basedir=".">


    <!-- print out some usage hints -->
    <target name="usage" description="prints a short usage">
        <echo>
Use case 1: developer build (in your local jython copy)
-------------------------------------------------------
  - call target 'developer-build' (which is the default for this build.xml)
This build will create directories /build and /dist below basedir.


Use case 2: full build for a release (using cvs checkout)
---------------------------------------------------------
  - make sure you have access to anonymous cvs
  - override cvs.tag in ant.properties (if necessary)
  - call target 'full-build'
This build will create a working directory named full_build_${cvs.tag} at the same
level as your local directories bugtests, jython, sandbox and installer.
It will contain a big jython_${cvs.tag}.jar file suitable for installation.


Use case 3: build only the parser (grammar)
-------------------------------------------
  - override javaccHome in ant.properties (if necessary)
  - call target 'parser'
or:
  - set javaccHome, either on the command line, or inside parser/build.xml
  - call parser/build.xml (default target)
This build will only create files inside org/python/parser.


Note on targets
---------------
The following targets are designed for direct invocation:
  - usage
  - developer-build
  - full-build
  - clean (uses developer-build settings if called directly)
  - parser (uses developer-build settings if called directly)
Following an ant convention, the callable targets have a description attribute.
All other targets may give unpredicted results if called directly.


Where ant.properties are searched
---------------------------------
  1. in user.home
  2. in the same directory as this build.xml file
The first setting of a property wins, further settings are ignored.


Actions for a release
---------------------
  1. determine the new cvs tag to be applied to jython
  2. determine the existing cvs tag of the CPython Lib files which should be included
  3. change the following properties in this build.xml, if necessary:
       - cvs.tag             (target: full-init)
       - python.cvs.tag      (target: full-init)
       - jdk.target.version  (target: pre-init)
  4. if new CPython .py files should be distributed, add them to build.Lib.include.properties
  5. adjust the public static String version in PySystemState.java
  6. check in all the changes
  7. apply the new tag to the jython cvs (all projects)
  8. call target 'full-build'



An example ant.properties file:
-------------------------------

# - define the home for javacc (only used for parser grammar)
javaccHome=${basedir}/../externals/javacc-3.2

# - ht2html tool for the doc target (only needed for full-build)
ht2html.dir=${basedir}/../externals/ht2html-2.0

# - define the home of the corresponding CPython version
python.home=c:/Programme/Python/Python22

# - javax.servlet
servlet.jar=c:/workspace/HEAD/CH.obj.commons.core/make_lib/j2ee.jar

# - org.gnu.readline
readline.jar=${basedir}/../externals/external-jars/readline.jar

# - zxJDBC
# (for mysql, see www.mysql.com/downloads/api-jdbc-stable.html)
# (for postgres, see http://jdbc.postgresql.org/)
mysql.jar=${basedir}/../externals/external-jars/mysql-connector-java-3.0.16-ga-bin.jar
postgresql.jar=${basedir}/../externals/external-jars/pg74.215.jdbc2.jar
oracle.jar=C:/workspace/HEAD/for_development/bisdevsrv28/jboss/server/infra/lib/ojdbc14.jar
#informix.jar=

# - option for javac (build.compiler=modern is a global option to use standard jdk 1.3/1.4/1.5)
#build.compiler=modern
#jdk.target.version=1.2
#debug=false
#optimize=off
#deprecation=off

# - the cvs tag to build from; only needed for full-build
#cvs.tag=Release_2_2alpha0
#cvs.tag=HEAD
#cvs.tag=pep302
        </echo>
    </target>


    <!-- developer build -->
    <target name="developer-build"
            depends="developer-build-called, developer-init, post-init, copy-dist"
            description="a local build for developers"
    />


    <!-- full build -->
    <target name="full-build" depends="full-init, post-init, install" description="a full build from cvs" />


    <!-- set a properety to indicate that target 'developer-build' is was really called -->
    <target name="developer-build-called">
        <property name="developer-build-called" value="true" />
    </target>


    <!-- initialize properties common to both developer build and full build -->
    <target name="pre-init">
        <!-- load from .properties file -->
        <echo>loading properties from ${user.home}/ant.properties</echo>
        <property file="${user.home}/ant.properties" />
        <echo>loading properties from ${basedir}/ant.properties</echo>
        <property file="${basedir}/ant.properties" />

        <property name="build.compiler" value="modern" />
        <property name="jdk.target.version" value="1.2" />
        <property name="jdk.source.version" value="1.3" />
        <property name="deprecation" value="off" />
        <property name="debug" value="off" />
        <property name="optimize" value="on" />
        <property name="nowarn" value="false" />

        <!-- classpaths -->
        <path id="main.classpath">
            <pathelement path="${readline.jar}" />
            <pathelement path="${servlet.jar}" />
            <pathelement path="${informix.jar}" />
            <pathelement path="${oracle.jar}" />
            <pathelement path="${mysql.jar}" />
            <pathelement path="${postgresql.jar}" />
            <pathelement path="${jndi.jar}" />
            <pathelement path="${jdbc.jar}" />
            <pathelement path="${java.class.path}" />
        </path>

        <available property="java2collection.present" classname="java.util.List" />
        <available property="threadlocal.present" classname="java.lang.ThreadLocal" />
        <available property="secureclassloader.present" classname="java.security.SecureClassLoader" />
        <available property="java2accessible.present" classname="java.lang.reflect.AccessibleObject" />
        <available property="weakref.present" classname="java.lang.ref.WeakReference" />
        <available property="servlet.present" classname="javax.servlet.Servlet" classpath="${servlet.jar}" />
        <available property="readline.present" classname="org.gnu.readline.Readline" classpath="${readline.jar}" />
        <available property="informix.present" classname="com.informix.jdbc.IfxDriver" classpath="${informix.jar}" />
        <available property="mysql.present" classname="org.gjt.mm.mysql.Driver" classpath="${mysql.jar}" />
        <available property="postgresql.present" classname="org.postgresql.Driver" classpath="${postgresql.jar}" />
        <available property="oracle.present" classname="oracle.jdbc.driver.OracleDriver" classpath="${oracle.jar}" />
        <available property="jndi.present" classname="javax.naming.Context" classpath="${jndi.jar}" />
        <available property="javax.sql.present" classname="javax.sql.DataSource" />
        <available property="jdbc30.present" classname="java.sql.ParameterMetaData" />
    </target>


    <!-- init properties for the developer build -->
    <target name="developer-init" depends="pre-init">
        <property name="work.dir" value="${basedir}" />
        <property name="source.dir" value="${basedir}" />
        <property name="python.lib" value="${python.home}/Lib" />
    </target>


    <!-- init properties for the full build -->
    <target name="full-init" depends="pre-init">
        <!-- use this property to distinguish a full-build from a developer-build -->
        <property name="full-build" value="true" />

        <!-- predefined cvs tags for jython and cpython -->
        <property name="cvs.tag" value="HEAD" />
        <property name="python.cvs.tag" value="r223" />

        <property name="work.dir" value="${basedir}/../full_build_${cvs.tag}" />
        <property name="cvs.checkout.dir" value="${work.dir}/checkout" />
        <property name="source.dir" value="${cvs.checkout.dir}/jython" />
        <property name="has.cvs.connection" value="true" />
        <property name="python.module" value="python/dist/src/Lib" />
        <property name="python.lib" value="${cvs.checkout.dir}/${python.module}" />
        <property name="python.exe" value="${python.home}/python" />
        <condition property="do.checkout" value="true">
            <istrue value="${has.cvs.connection}" />
        </condition>
    </target>


    <target name="post-init">
        <property name="output.dir" value="${work.dir}/build" />
        <property name="dist.dir" value="${work.dir}/dist" />
        <property name="apidoc.dir" value="${dist.dir}/Doc/javadoc" />
        <property name="parser.dir" value="${source.dir}/org/python/parser" />
        <echo>.</echo>
        <echo>Build environment for ${ant.project.name}</echo>
        <echo>(Note: if ${propertyname} is displayed, then the property is not set)</echo>
        <echo>--- optional libraries ---</echo>
        <echo>collections        = '${java2collection.present}'</echo>
        <echo>weakref            = '${weakref.present}'</echo>
        <echo>threadlocal        = '${threadlocal.present}'</echo>
        <echo>java2 access       = '${java2accessible.present}'</echo>
        <echo>secureclassloader  = '${secureclassloader.present}'</echo>
        <echo>servlet            = '${servlet.present}'</echo>
        <echo>readline           = '${readline.present}'</echo>
        <echo>oracle             = '${oracle.present}'</echo>
        <echo>informix           = '${informix.present}'</echo>
        <echo>mysql              = '${mysql.present}'</echo>
        <echo>postgresql         = '${postgresql.present}'</echo>
        <echo>jndi               = '${jndi.present}'</echo>
        <echo>jdbc               = '${javax.sql.present}'</echo>
        <echo>jdbc3.0            = '${jdbc30.present}'</echo>
        <echo>--- properties ---</echo>
        <echo>work.dir           = '${work.dir}'</echo>
        <echo>source.dir         = '${source.dir}'</echo>
        <echo>parser.dir         = '${parser.dir}'</echo>
        <echo>output.dir         = '${output.dir}'</echo>
        <echo>dist.dir           = '${dist.dir}'</echo>
        <echo>apidoc.dir         = '${apidoc.dir}'</echo>
        <echo>python.lib         = '${python.lib}'</echo>
        <echo>javaccHome         = '${javaccHome}'</echo>
        <echo>ht2html.dir        = '${ht2html.dir}'</echo>
        <echo>build.compiler     = '${build.compiler}'</echo>
        <echo>jdk.target.version = '${jdk.target.version}'</echo>
        <echo>jdk.source.version = '${jdk.source.version}'</echo>
        <echo>deprecation        = '${deprecation}'</echo>
        <echo>debug              = '${debug}'</echo>
        <echo>optimize           = '${optimize}'</echo>
        <echo>nowarn             = '${nowarn}'</echo>
        <echo>--- properties (used for full-build only )---</echo>
        <echo>cvs.tag            = '${cvs.tag}'</echo>
        <echo>python.cvs.tag     = '${python.cvs.tag}'</echo>
        <echo>cvs.checkout.dir   = '${cvs.checkout.dir}'</echo>
        <echo>do.checkout        = '${do.checkout}'</echo>
        <echo>python.exe         = '${python.exe}'</echo>
    </target>


    <!-- delete what's necessary. should correspond to the directories created in prepare  -->
    <!-- if called directly, we use settings as in developer-build -->
    <!-- (at the moment all properties will already be set if we do a full build) -->
    <target name="clean"
            depends="developer-init, post-init, clean-checkout-dir"
            unless="developer-build-called"
            description="clean up build working directories"
    >
        <!-- do not hard delete ${work.dir}, since it could be basedir -->
        <!-- deletes all files and subdirectories of ${output.dir}, without ${output.dir} itself. -->
        <delete includeemptydirs="true" failonerror="false">
            <fileset dir="${output.dir}" includes="**/*" />
        </delete>
        <!-- deletes all files and subdirectories of ${dist.dir}, without ${dist.dir} itself. -->
        <delete includeemptydirs="true" failonerror="false">
            <fileset dir="${dist.dir}" includes="**/*" />
        </delete>
        <!-- delete the installation .jar file from ${work.dir}, but no other files -->
        <delete failonerror="false">
            <fileset dir="${work.dir}" includes="jython*.jar" />
        </delete>
    </target>


    <!-- clean cvs.checkout.dir if we really checkout -->
    <target name="clean-checkout-dir" if="do.checkout">
        <delete includeemptydirs="true" failonerror="false">
            <fileset dir="${cvs.checkout.dir}" includes="**/*" defaultexcludes="no" />
        </delete>
    </target>


    <!-- create necessary directories -->
    <target name="prepare" depends="prepare-full, prepare-checkout">
        <mkdir dir="${output.dir}" />
        <mkdir dir="${dist.dir}" />
    </target>


    <!-- create directories needed only in full-build -->
    <target name="prepare-full" depends="clean" if="full-build">
        <mkdir dir="${work.dir}" />
        <mkdir dir="${dist.dir}/Doc" />
        <mkdir dir="${apidoc.dir}" />
    </target>


    <!-- create checkout directory if necessary -->
    <target name="prepare-checkout" if="do.checkout">
        <mkdir dir="${cvs.checkout.dir}" />
    </target>


    <!-- checkout from cvs if so defined -->
    <target name="checkout" depends="prepare" if="do.checkout">
        <!-- common properties -->
        <property name="sf.cvs.root" value=":pserver:anonymous@cvs.sourceforge.net:/cvsroot" />

        <!-- jython -->
        <property name="jython.cvs.root" value="${sf.cvs.root}/jython" />
        <echo>setting jython password for anonymous</echo>
        <cvspass cvsroot="${jython.cvs.root}" password="" />
        <!-- -r: use the cvs tag, -P: prune empty directories -->
        <property name="jython.checkout.options" value="checkout -r ${cvs.tag} -P" />
        <property name="jython.checkout.command" value="-z3 -d${jython.cvs.root} ${jython.checkout.options}" />
        <echo>checking out jython with the following command: ${jython.checkout.command} jython</echo>
        <cvs command="${jython.checkout.command} jython" dest="${cvs.checkout.dir}" />
        <!-- -f: use HEAD if tag not found, -r: use the cvs tag, -P: prune empty directories -->
        <property name="installer.checkout.options" value="checkout -f -r ${cvs.tag} -P" />
        <property name="installer.checkout.command" value="-z3 -d${jython.cvs.root} ${installer.checkout.options}" />
        <echo>checking out installer with the following command: ${installer.checkout.command} installer</echo>
        <cvs command="${installer.checkout.command} installer" dest="${cvs.checkout.dir}" />

        <!-- cpython -->
        <property name="python.cvs.root" value="${sf.cvs.root}/python" />
        <echo>setting python password for anonymous</echo>
        <cvspass cvsroot="${python.cvs.root}" password="" />
        <!-- -r: use the cvs tag, -P: prune empty directories -->
        <property name="python.checkout.options" value="checkout -r ${python.cvs.tag} -P" />
        <property name="python.checkout.command" value="-z3 -d${python.cvs.root} ${python.checkout.options}" />
        <echo>checking out ${python.module} with the following command: ${python.checkout.command} ${python.module}</echo>
        <cvs command="${python.checkout.command} ${python.module}" dest="${cvs.checkout.dir}" />
    </target>


    <!-- separate build.xml for parser grammar -->
    <!-- we use settings as in developer-build - at the moment all properties will already be set if we do a full build -->
    <target name="parser" depends="developer-init, post-init, prepare" if="javaccHome" description="the grammar build">
        <echo>processing ${parser.dir}/build.xml</echo>
        <ant dir="${parser.dir}" />
    </target>


    <!-- compile java sources -->
    <target name="compile" depends="checkout, parser">
        <javac srcdir="${source.dir}/"
               destdir="${output.dir}/"
               target="${jdk.target.version}"
               source="${jdk.source.version}"
               debug="${debug}"
               optimize="${optimize}"
               deprecation="${deprecation}"
               nowarn="${nowarn}"
        >
            <include name="org/**" />
            <exclude name="org/python/parser/python.java" />

            <include name="com/ziclix/python/sql/**" if="java2collection.present" />
            <!-- +++ TODO: the following java files could be removed from cvs since we are targeting jdk 1.2 -->
            <exclude name="**/CollectionProxy2.java" unless="java2collection.present" />
            <exclude name="**/Java2Accessibility.java" unless="java2accessible.present" />
            <exclude name="**/BytecodeLoader2.java" unless="secureclassloader.present" />
            <exclude name="**/ThreadStateMapping2.java" unless="threadlocal.present" />
            <exclude name="**/InternalTables2.java" unless="weakref.present" />
            <exclude name="**/WeakInternalTables.java" unless="weakref.present" />
            <exclude name="**/AutoInternalTables.java" unless="weakref.present" />
            <exclude name="**/SoftIInternalTables.java" unless="weakref.present" />
            <exclude name="**/_weakref.java" unless="weakref.present" />
            <!-- end of java files to be removed from cvs -->
            <exclude name="**/PyServlet.java" unless="servlet.present" />
            <exclude name="**/ReadlineConsole.java" unless="readline.present" />
            <exclude name="**/handler/InformixDataHandler.java" unless="informix.present" />
            <exclude name="**/handler/MySQLDataHandler.java" unless="mysql.present" />
            <exclude name="**/handler/OracleDataHandler.java" unless="oracle.present" />
            <exclude name="**/handler/PostgresqlDataHandler.java" unless="postgresql.present" />
            <exclude name="**/connect/Lookup.java" unless="jndi.present" />
            <exclude name="**/connect/Lookup.java" unless="javax.sql.present" />
            <exclude name="**/connect/Connectx.java" unless="javax.sql.present" />
            <exclude name="**/JDBC30DataHandler.java" unless="jdbc30.present" />
            <classpath refid="main.classpath" />
        </javac>

        <javac srcdir="${source.dir}/Lib"
               includes="jxxload_help/**"
               destdir="${output.dir}/"
               target="${jdk.target.version}"
               source="${jdk.source.version}"
               debug="${debug}"
               optimize="${optimize}"
               deprecation="${deprecation}"
               nowarn="${nowarn}"
        />

        <!-- java files used by tests -->
        <javac srcdir="${source.dir}/Lib/test/"
               includes="javatests/**"
               destdir="${output.dir}/"
               target="${jdk.target.version}"
               source="${jdk.source.version}"
               debug="${debug}"
               optimize="${optimize}"
               deprecation="${deprecation}"
               nowarn="${nowarn}"
        />

        <copy file="org/python/modules/ucnhash.dat"
              todir="${output.dir}/org/python/modules"
              preservelastmodified="true"
        />

        <copy todir="${output.dir}/com" preservelastmodified="true">
            <fileset dir="${source.dir}/com">
                <include name="**/*.properties" if="java2collection.present" />
            </fileset>
        </copy>
    </target>


    <!-- build jython.jar -->
    <target name="jar" depends="compile">
        <jar destfile="${dist.dir}/jython.jar"
             basedir="${output.dir}"
             update="true">
          <include name="com/**/*" />
          <include name="org/**/*" />
          <include name="jxxload_help/*" />
          <include name="javatests/*" />
          <manifest>
              <attribute name="Main-Class" value="org.python.util.jython" />
              <attribute name="Built-By" value="${user.name}" />
              <!-- info section. ATTN: no blanks, no '.' in the names -->
              <section name="Build-Info">
                  <attribute name="version" value="${cvs.tag}" />
                  <attribute name="cvs-build" value="${do.checkout}" />
                  <attribute name="collections" value="${java2collection.present}" />
                  <attribute name="weakref" value="${weakref.present}" />
                  <attribute name="threadlocal" value="${threadlocal.present}" />
                  <attribute name="java2-accessibility" value="${java2accessible.present}" />
                  <attribute name="secureclassloader" value="${secureclassloader.present}" />
                  <attribute name="servlet" value="${servlet.present}" />
                  <attribute name="readline" value="${readline.present}" />
                  <attribute name="oracle" value="${oracle.present}" />
                  <attribute name="informix" value="${informix.present}" />
                  <attribute name="mysql" value="${mysql.present}" />
                  <attribute name="postgresql" value="${postgresql.present}" />
                  <attribute name="jndi" value="${jndi.present}" />
                  <attribute name="jdbc" value="${javax.sql.present}" />
                  <attribute name="jdbc3_0" value="${jdbc30.present}" />
                  <attribute name="build-compiler" value="${build.compiler}" />
                  <attribute name="jdk-target-version" value="${jdk.target.version}" />
                  <attribute name="debug" value="${debug}" />
                  <attribute name="optimize" value="${optimize}" />
              </section>
          </manifest>
        </jar>
    </target>


    <!-- build the .html files using the ht2html tool -->
    <target name="doc" depends="compile" if="full-build">
        <fail unless="ht2html.dir" message="ht2html.dir is not set" />
        <copy todir="${dist.dir}/Doc" preservelastmodified="true">
            <fileset dir="Doc" includes="*.ht, **/*.gif" />
        </copy>
        <!-- Create .html files in Doc -->
        <apply executable="${python.exe}" dir="Doc">
            <env key="PYTHONPATH" path="${source.dir}/Misc/htgen" />
            <arg line="${ht2html.dir}/ht2html.py" />
            <arg line="-s JyLocalGenerator" />
            <fileset dir="${dist.dir}/Doc">
                <include name="*.ht" />
            </fileset>
        </apply>
        <delete>
            <fileset dir="${dist.dir}/Doc" includes="*.ht" />
        </delete>
    </target>


    <!-- javadoc -->
    <target name="javadoc" depends="compile" if="full-build">
        <javadoc sourcepath="${source.dir}"
                 destdir="${apidoc.dir}"
                 source="${jdk.source.version}"
                 public="true"
                 breakiterator="yes"
                 packagenames="org.python.core, org.python.util, com.ziclix.python.sql"
                 windowtitle="Jython API documentation"
                 bottom="&lt;a href='http://www.jython.org' target='_top'>Jython homepage&lt;/a>"
        >
            <classpath refid="main.classpath" />
        </javadoc>
    </target>


    <!-- copy for full distribution -->
    <target name="copy-full" if="full-build">
        <!-- Misc files -->
        <echo>copy misc files from ${source.dir}</echo>
        <copy todir="${dist.dir}" preservelastmodified="true">
            <fileset dir="${source.dir}"
                     includes="ACKNOWLEDGMENTS, build.xml, build.Lib.include.properties, NEWS, LICENSE.txt, README.txt, registry"
            />
        </copy>

        <!-- copy the CPython license -->
        <echo>copy CPython LICENSE from ${python.home} to ${dist.dir}/LICENSE_CPython.txt</echo>
        <!-- +++ TODO: checkout the CPython LICENSE (not: .txt) and copy from there -->
        <copy file="${python.home}/LICENSE.txt" tofile="${dist.dir}/LICENSE_CPython.txt" preservelastmodified="true" />

        <!-- sources: todir has to correspond with installer/**/JarInstaller.java -->
        <echo>copy sources from ${source.dir}</echo>
        <copy todir="${dist.dir}/src/java" preservelastmodified="true">
            <fileset dir="${source.dir}">
              <include name="org/**/*.java" />
              <include name="com/**/*.java" />
              <include name="com/**/*.properties" />
              <include name="Lib/jxxload_help/*.java" />
              <include name="Lib/test/javatests/*.java" />
              <include name="org/**/ucnhash.dat" />
              <include name="org/python/parser/build.xml" />
              <exclude name="org/python/parser/python.java" />
            </fileset>
        </copy>

        <!-- The demo files -->
        <echo>copy the demo files from ${source.dir}/Demo</echo>
        <copy todir="${dist.dir}/Demo" preservelastmodified="true">
            <fileset dir="${source.dir}/Demo">
              <include name="**/*.java" />
              <include name="**/*.html" />
              <include name="**/*.py" />
              <include name="**/*.txt" />
              <include name="**/*.xml**" />
              <include name="**/jreload/example.jar" />
              <include name="**/jreload/_xample/Version.class" />
              <exclude name="**/jpywork/**" />
            </fileset>
        </copy>
    </target>


    <!-- copy for distribution -->
    <target name="copy-dist" depends="jar, doc, javadoc, copy-full">
        <!-- Tools: jythonc and freeze -->
        <echo>copy Tools from ${source.dir}/Tools</echo>
        <copy todir="${dist.dir}" preservelastmodified="true">
            <fileset dir="${source.dir}" includes="Tools/**/*.py" />
        </copy>

        <!-- Copy the CPython standard library files -->
        <echo>copy CPython/Lib *.py files from ${python.lib}</echo>
        <copy todir="${dist.dir}/Lib" preservelastmodified="true">
            <fileset dir="${python.lib}" excludes="**/*.pyc, **/*.pyo">
                <patternset>
                    <includesfile name="${source.dir}/build.Lib.include.properties" />
                </patternset>
            </fileset>
        </copy>

        <!-- The jython .py modules: important to overwrite the above CPython .py files -->
        <echo>copy the jython *.py modules from ${source.dir}/Lib</echo>
        <copy todir="${dist.dir}/Lib" preservelastmodified="true" overwrite="true">
            <fileset dir="${source.dir}/Lib" excludes="**/*.class"/>
        </copy>
    </target>


    <!-- wrap the build into the installer -->
    <target name="install" depends="copy-dist">
        <fail unless="cvs.tag" message="no cvs.tag specified" />
        <property name="install.src.dir" value="${source.dir}/../installer" />
        <echo>compiling installer from ${install.src.dir}</echo>
        <javac srcdir="${install.src.dir}"
               includes="org/**"
               destdir="${output.dir}/"
               target="${jdk.target.version}"
               source="${jdk.source.version}"
               debug="${debug}"
               optimize="${optimize}"
               deprecation="${deprecation}"
               nowarn="${nowarn}"
        />
        <echo>copy installer classes to ${dist.dir}</echo>
        <copy todir="${dist.dir}" preservelastmodified="true">
            <fileset dir="${output.dir}" includes="org/python/util/install/*.class" />
        </copy>
        <echo>copy installer icon to ${dist.dir}</echo>
        <copy todir="${dist.dir}" preservelastmodified="true">
            <!-- check no /bin directory -->
            <fileset dir="${install.src.dir}" includes="**/*.png" excludes="bin/**" />
        </copy>
        <echo>building installer .jar file</echo>
        <jar destfile="${work.dir}/jython_${cvs.tag}.jar" basedir="${dist.dir}" update="true">
            <manifest>
                <attribute name="Main-Class" value="org.python.util.install.Installation" />
                <attribute name="Built-By" value="${user.name}" />
                <!-- section for the install program -->
                <section name="Jython">
                    <attribute name="version" value="${cvs.tag}" />
                    <attribute name="exclude-dirs" value="org;META-INF" />
                </section>
                <!-- info section. ATTN: no blanks, no '.' in the names -->
                <section name="Build-Info">
                    <attribute name="cvs-build" value="${do.checkout}" />
                    <attribute name="cpython-version" value="${python.cvs.tag}" />
                    <attribute name="collections" value="${java2collection.present}" />
                    <attribute name="weakref" value="${weakref.present}" />
                    <attribute name="threadlocal" value="${threadlocal.present}" />
                    <attribute name="java2-accessibility" value="${java2accessible.present}" />
                    <attribute name="secureclassloader" value="${secureclassloader.present}" />
                    <attribute name="servlet" value="${servlet.present}" />
                    <attribute name="readline" value="${readline.present}" />
                    <attribute name="oracle" value="${oracle.present}" />
                    <attribute name="informix" value="${informix.present}" />
                    <attribute name="mysql" value="${mysql.present}" />
                    <attribute name="postgresql" value="${postgresql.present}" />
                    <attribute name="jndi" value="${jndi.present}" />
                    <attribute name="jdbc" value="${javax.sql.present}" />
                    <attribute name="jdbc3_0" value="${jdbc30.present}" />
                    <attribute name="build-compiler" value="${build.compiler}" />
                    <attribute name="jdk-target-version" value="${jdk.target.version}" />
                    <attribute name="debug" value="${debug}" />
                    <attribute name="optimize" value="${optimize}" />
                </section>
            </manifest>
        </jar>
    </target>


</project>