Author: bugman Date: Tue Jun 10 10:16:39 2014 New Revision: 23782 URL: http://svn.gna.org/viewcvs/relax?rev=23782&view=rev Log: Merged revisions 23779-23781 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r23779 | bugman | 2014-06-10 10:07:22 +0200 (Tue, 10 Jun 2014) | 6 lines Fix for the scons target for compiling the relax manual when using a repository checkout copy. The method for compiling the relax manual was calling the version.revision() function, however this has been replaced a while ago by the version.repo_revision variable. ........ r23780 | bugman | 2014-06-10 10:08:33 +0200 (Tue, 10 Jun 2014) | 6 lines Created two unit tests for the lib.io.file_root() function. The second of the tests demonstrate a failure of the function if multiple file extensions are present. ........ r23781 | bugman | 2014-06-10 10:13:29 +0200 (Tue, 10 Jun 2014) | 5 lines Bug fix for the lib.io.file_root() function for multiple file extensions. The function will now strip off all file extensions. ........ Modified: branches/frame_order_cleanup/ (props changed) branches/frame_order_cleanup/lib/io.py branches/frame_order_cleanup/scons/manuals.py branches/frame_order_cleanup/test_suite/unit_tests/_lib/test_io.py Propchange: branches/frame_order_cleanup/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Tue Jun 10 10:16:39 2014 @@ -1 +1 @@ -/trunk:1-23776 +/trunk:1-23781 Modified: branches/frame_order_cleanup/lib/io.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/io.py?rev=23782&r1=23781&r2=23782&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/io.py (original) +++ branches/frame_order_cleanup/lib/io.py Tue Jun 10 10:16:39 2014 @@ -165,8 +165,13 @@ @rtype: str """ - root, ext = splitext(file_path) - return basename(root) + # Loop over all file extensions, stopping when none are left. + ext = None + while ext != '': + file_path, ext = splitext(file_path) + + # Return the file root with the directories stripped. + return basename(file_path) def get_file_path(file_name=None, dir=None): Modified: branches/frame_order_cleanup/scons/manuals.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/scons/manuals.py?rev=23782&r1=23781&r2=23782&view=diff ============================================================================== --- branches/frame_order_cleanup/scons/manuals.py (original) +++ branches/frame_order_cleanup/scons/manuals.py Tue Jun 10 10:16:39 2014 @@ -503,7 +503,7 @@ # Add the repository revision if not a normal release. text = version.version if text == 'repository checkout': - text += ' r%s' % version.revision() + text += ' r%s' % version.repo_revision # Place the program version number into a LaTeX file. file = open(env['LATEX_DIR'] + sep + 'relax_version.tex', 'w') Modified: branches/frame_order_cleanup/test_suite/unit_tests/_lib/test_io.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/unit_tests/_lib/test_io.py?rev=23782&r1=23781&r2=23782&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/unit_tests/_lib/test_io.py (original) +++ branches/frame_order_cleanup/test_suite/unit_tests/_lib/test_io.py Tue Jun 10 10:16:39 2014 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2007-2013 Edward d'Auvergne # +# Copyright (C) 2007-2014 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -29,6 +29,28 @@ class Test_io(TestCase): """Unit tests for the functions of the 'lib.io' module.""" + + + def test_file_root(self): + """Test the lib.io.file_root() function with '/tmp/test.xyz'.""" + + # The data. + file = '/tmp/test.xyz' + root = 'test' + + # Check the function. + self.assertEqual(lib.io.file_root(file), root) + + + def test_file_root2(self): + """Test the lib.io.file_root() function with '/tmp/test.xyz.gz'.""" + + # The data. + file = '/tmp/test.xyz.gz' + root = 'test' + + # Check the function. + self.assertEqual(lib.io.file_root(file), root) def test_get_file_path(self):