Commits

Olemis Lang  committed 58487af
  • Participants
  • Parent commits 36b7e5b
  • Tags fsl_0.5.1

Comments (0)

Files changed (30)

 include MANIFEST.in
 include README.txt
 include fsl/*.py
-include fsl/test/testdir/*
 include fsl/test/fsltool_files/*
 include fsl/test/interpreter_files/*
 include fsl/test/lexer_files/*
-include fsl/test/make_struct.sh
 include fsl/test/struct.txt
+include doc/bugs.txt
+include doc/changelog.html
 include doc/fsl.css
 include doc/fsltool.html
 include doc/index.html
 Metadata-Version: 1.0
 Name: fsl
-Version: 0.5
-Summary: File Selection Language
+Version: 0.5.1
+Summary: Specification language for selecting files from directory tree
 Home-page: http://www.cs.helsinki.fi/u/hkovaska/fsl/
 Author: Kristian Ovaska
 Author-email: kristian.ovaska [at] helsinki.fi
 Author: Kristian Ovaska (kristian.ovaska [at] helsinki.fi) 
 WWW: http://www.cs.helsinki.fi/u/hkovaska/fsl/
-Version: 0.5
+Version: 0.5.1
 
 File Selection Language (FSL) is a descriptive language for
 file selection. It is used to selectively pick files from

File doc/bugs.txt

+Bud ID: 1
+Found: 2005-11-21
+Version(s): 0.5
+Platform(s): All(?); at least Windows
+Description: When root directory is the root of file system, globs beginning 
+with * don't work
+Severity: High
+Details: The root directory for the rule got transformed into the current 
+directory (cwd) instead of the real root directory..
+
+------------------------------------------------------------------------
+
+Bud ID: 2
+Found: 2005-11-26
+Version(s): 0.5
+Platform(s): All
+Severity: Low
+Description: make_struct.sh fails by raising exceptions
+Details: The fault is due to missing imports in tutils.py.
+
+------------------------------------------------------------------------
+
+Bud ID: 3
+Found: 2005-11-26
+Version(s): 0.5
+Platform(s): All(?)
+Severity: Low
+Description: Test cases that check the modification time of a file don't work.
+Details: The test suite assumes a particular modification time for the file 
+"filea". However, the time may be off by several hours because of time zone 
+differences.
+Fix: The test directory tree is generated each time the test suite is executed 
+by testall.py.
+
+------------------------------------------------------------------------
+
+Bud ID: 4
+Found: 2005-11-26
+Version(s): 0.5
+Platform(s): All
+Severity: Low
+Description: Interpreter.run raised other exceptions (such as WindowsError) than 
+the ones mentioned in documentation

File doc/changelog.html

+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+        "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html lang="en">
+
+<head>
+    <title>File Selection Language</title>
+    <link rel="stylesheet" href="fsl.css" type="text/css">
+    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+    <meta name="author" content="Kristian Ovaska">
+</head>
+
+<body>
+
+<h1>Change log for File Selection Language</h1>
+
+<h2>Version 0.5.1 (2005-12-05)</h2>
+
+<p>
+This is a bug fix release.
+</p>
+
+<h3>Bug fixes</h3>
+<ul>
+<li>When root directory is the root of file system, globs beginning
+    with * don't work (severity: high)
+<li>make_struct.sh fails by raising exceptions (severity: low)
+<li>test cases that check the modification time of a file don't work
+    (severity: low)
+<li>Interpreter.run raised other exceptions (such as WindowsError)
+    than the ones mentioned in documentation (severity: low)
+</ul>
+
+<h2>Version 0.5 (2005-10-21)</h2>
+<p>
+First public release.
+</p>
+
+<p>
+<hr>
+Up: <a href="index.html">FSL index</a><br>
+Updated 2005-12-04
+</body>
+</html>

File doc/index.html

 Author: <a href="http://www.cs.helsinki.fi/u/hkovaska/">Kristian Ovaska</a>
         (kristian.ovaska [at] helsinki.fi) <br>
 License: BSD<br>
-Version: 0.5 (2005-10-21)<br>
+Version: 0.5.1 (2005-12-05)<br>
 Requirements: Python 2.3 or greater<br>
 Platforms: Unix, Windows
 
 date can be used in expressions.
 
 <p>
+Report bugs, send suggestions and give feedback to the author.
+
+<p>
 See documentation:
 <ul>
 <li><a href="language.html">File Selection Language Reference</a>
 <li><a href="fsltool.html">fsltool</a> usage (command-line tool)
+<li><a href="changelog.html">Change log</a>
+<li><a href="bugs.txt">Bug database</a>
 </ul>
 
 <!-- UNCOMMENT for WWW index
 <h2 id="download">Download</h2>
-<p>
-FSL 0.5: 
-<a href="fsl-0.5.zip">fsl-0.5.zip</a> (72 KB)
+
+<table>
+<tr>
+  <th>Version
+  <th>File
+  <th>Size
+  <th>MD5
+<tr>
+  <td>FSL 0.5
+  <td><a href="fsl-0.5.zip">fsl-0.5.zip</a>
+  <td>72 KB
+  <td>2d5888b27f66889ceb99732ca798243c
+<tr>
+  <td><b>FSL 0.5.1</b>
+  <td><a href="fsl-0.5.1.zip">fsl-0.5.1.zip</a>
+  <td>72 KB
+  <td>-
+</table>
 -->
 
 <h2>Example</h2>
 
 <p>
 <hr>
-Updated 2005-10-21
+Updated 2005-12-04
 </body>
 </html>

File doc/language.html

 <h1>File Selection Language Reference</h1>
 
 <p>
-Version 0.5 (2005-10-21)<br>
+Version 0.5.1 (2005-12-05)<br>
 Kristian Ovaska (kristian.ovaska [at] helsinki.fi)
 
 <h2>Contents</h2>
 There are limitations to bare strings. Bare strings:
 <ul>
 <li>may not contain whitespace
-<li>may not contain the characters <tt>, ( ) " &lt; &gt; = ( ) # | !</tt>
+<li>may not contain the characters <tt>, ( ) " &lt; &gt; = # | !</tt>
 <li>may not be a reserved word: AND, EACH, IF, IN, NONREC, NOT, OR
 <li>can't be used in expressions (see <a href="#expressions">below</a>)
 </ul>
 matching rule is applied.
 
 <p>
-For example, there are the following rules:
+For example, consider the following rules:
 
 <pre class="code">
 *
 included in the file set.
 
 <p>
-An ill-formed rule set:
+A rule set that may not do what one wishes it to do:
 
 <pre class="code">
 NOT *.jpg
 
 <p>
 This matches all files, including *.jpg files, because
-the last rule (*) tells to include all files. Also, no exclusive
+the last rule (*) tells to include all files. No exclusive
 rule at the beginning of a rule set ever has any effect.
 Indeed, the FSL interpreter warns you in this case:
-    Warning: exclusive rule at beginning - has no effect
+    <i>Warning: exclusive rule at beginning - has no effect</i>.
 
 <p>
 Usually, you should have inclusion rules at the beginning of the
 <p>
 <hr>
 Up: <a href="index.html">FSL index</a><br>
-Updated 2005-10-21
+Updated 2005-11-04
 </body>
 </html>

File fsl/Interpreter.py

         for glob_pattern in foreach_rule.glob_patterns:
             self._scan_glob(glob_pattern, glob_pattern.innerdir, foreach_rule.if_expr, foreach_rule.variable_expr)
 
-
     def _scan_glob(self, glob_pattern_node, scan_directory, if_expr, variable_expr):
         if not os.path.exists(scan_directory):
             if _DEBUG:
         files_count = 0
         bytes_count = 0
 
-        files = os.listdir(scan_directory)
+        try:
+            files = os.listdir(scan_directory)
+        except (IOError, WindowsError):
+            raise globals.FSLRuntimeError, "Can't get directory listing of '%s'" % scan_directory
         files.sort()
 
         for filename in files:
             fullpath = utils.pathjoin(scan_directory, filename)
-#            print scan_directory, filename, fullpath
 
             if os.path.isdir(fullpath) and glob_pattern_node.recursive: # Directory
                 newdir = utils.pathjoin(scan_directory, filename)

File fsl/test/make_dir_struct.py

     mod_timestamp = time.mktime(modtime.timetuple())
     os.utime(filename, (mod_timestamp, mod_timestamp))
 
+def make_tree(config_filename, directory):
+    config_entries = list(read_config(config_filename))
+
+    if not os.path.exists(directory):
+        os.makedirs(directory)
+    old_cwd = os.getcwd()
+    os.chdir(directory)
+
+    for filename, size, modtime in config_entries:
+#        print filename, size, modtime
+        make_file(filename, size, modtime)
+
+    os.chdir(old_cwd)
 
 def main(args):
     if not args:
         print 'Usage: make_dir_struct <config file>'
         return
 
-    for filename, size, modtime in read_config(args[0]):
-        print filename, size, modtime
-        make_file(filename, size, modtime)
-
+    make_tree(args[0])
 
 if __name__=='__main__':
     import sys

File fsl/test/make_struct.sh

-#! /bin/bash
-cd testdir
-python ../make_dir_struct.py ../struct.txt
-cd ..

File fsl/test/testall.py

 import os
 import unittest
 
+import make_dir_struct
+import tutils
+
 modules = [
     'test_fsltool',
     'test_functions',
     'test_lexer'
 ]
 
+DIR_STRUCT_FILE = 'struct.txt'
+
 def main(args):
     try:
         import fsl.AST
         sys.path.append(parent)
         import fsl.AST
 
+    make_dir_struct.make_tree(DIR_STRUCT_FILE, tutils.ROOTDIR)
+
     mainSuite = unittest.TestSuite()
     for module in modules:
         suite = unittest.defaultTestLoader.loadTestsFromName(module)

File fsl/test/testdir/.hidden

Empty file removed.

File fsl/test/testdir/ALLCAPS

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/and

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/dir xyz/aaa

-xxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/dir xyz/filea

-xxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/dir xyz/q q q

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/dir1/dir2/asdf

-xxxxxxxxxx

File fsl/test/testdir/dir1/dir2/dir3/filez

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/dir1/dir2/dir3/qwerty

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/dir1/filea

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/dir1/filea-a-a

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/filea

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/fileb.txt

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/filec.txt.exe

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/filed

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/testdir/long-filename-1234567890-abcdefghijkl

-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

File fsl/test/tutils.py

 import glob
 import datetime
+import types
+import re
 
 ROOTDIR = 'testdir'
 

File fsl/utils.py

 
     innerdir = abspath(calc_innerdir(rootdir + globpattern))
 
-    if globpattern.startswith('*'):
+    if globpattern.startswith('*') and len(rootdir)!=1 and (len(rootdir)!=3 or rootdir[1]!=':'):
+        # To properly support patterns beginning with "*", we
+        # produce the fullglob "/rootdir*" instead of "/rootdir/*";
+        # but not if the rootdir is root directory of file system.
+        # (On Windows "d:/", on Unix "/".)
         rootdir = rootdir[:-1] # remove tailing "/"
+
     fullglob = abspath(rootdir + globpattern)
-
     return fullglob, innerdir
 
 def calc_innerdir(fullglob):
 import sys
 from distutils.core import setup
 
+SHORT_DESC = 'Specification language for selecting files from directory tree'
+
 LONG_DESC = '''\
 File Selection Language (FSL) is a descriptive language for file selection.
 It is used to selectively pick files from a directory structure.
   path. To make sure you installed FSL correctly on the search
   path, execute "import fsl.fsltool" in a Python session.'''
 
-TEST_DIR = 'testdir/'
-
-TEST_DIR_STRUCT = [
-    TEST_DIR + "and",
-    TEST_DIR + "filea",
-    TEST_DIR + "fileb.txt",
-    TEST_DIR + "filec.txt.exe",
-    TEST_DIR + "filed",
-    TEST_DIR + "ALLCAPS",
-    TEST_DIR + ".hidden",
-    TEST_DIR + "long-filename-1234567890-abcdefghijkl",
-    TEST_DIR + "dir1/filea",
-    TEST_DIR + "dir1/filea-a-a",
-    TEST_DIR + "dir1/dir2/asdf",
-    TEST_DIR + "dir1/dir2/dir3/filez",
-    TEST_DIR + "dir1/dir2/dir3/qwerty",
-    TEST_DIR + "dir xyz/aaa",
-    TEST_DIR + "dir xyz/filea",
-    TEST_DIR + "dir xyz/q q q",
-]
-
 CLASSIFIERS = [
           'Development Status :: 4 - Beta',
           'Environment :: Console',
 
 package_data = {
     'fsl.test': ['fsltool_files/*', 'interpreter_files/*', 'lexer_files/*',
-        'make_struct.sh', 'struct.txt'] + TEST_DIR_STRUCT
+        'make_struct.sh', 'struct.txt']
 }
 
 if __name__=='__main__':
         sys.exit(1)
 
     setup(name='fsl',
-          version='0.5',
-          description='File Selection Language',
+          version='0.5.1',
+          description=SHORT_DESC,
           author='Kristian Ovaska',
           author_email='kristian.ovaska [at] helsinki.fi',
           url='http://www.cs.helsinki.fi/u/hkovaska/fsl/',