From 5606215e9faa2069195026debcf2fa53634b97cd Mon Sep 17 00:00:00 2001 From: Stuart Rackham Date: Tue, 15 Jan 2013 11:08:43 +1300 Subject: a2x: the --destination-dir option now works correctly when specifying a DocBook XML source file. See https://groups.google.com/group/asciidoc/browse_thread/thread/95eefd39149bd675 --- a2x.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/a2x.py b/a2x.py index 1b192a2..91e7a92 100755 --- a/a2x.py +++ b/a2x.py @@ -376,7 +376,8 @@ class A2X(AttrDict): self.to_backend() else: self.__getattribute__('to_'+self.format)() - if not (self.keep_artifacts or self.format == 'docbook' or self.skip_asciidoc): + if not (self.keep_artifacts or self.format == 'docbook' or + self.dst_path('.xml') == self.asciidoc_file): shell_rm(self.dst_path('.xml')) def load_conf(self): @@ -443,7 +444,7 @@ class A2X(AttrDict): ''' if not os.path.isfile(self.asciidoc_file): die('missing SOURCE_FILE: %s' % self.asciidoc_file) - self.asciidoc_file = os.path.abspath(self.asciidoc_file) + self.asciidoc_file = os.path.realpath(self.asciidoc_file) if not self.destination_dir: self.destination_dir = os.path.dirname(self.asciidoc_file) else: @@ -539,7 +540,7 @@ class A2X(AttrDict): Return name of file or directory in the destination directory with the same name as the asciidoc source file but with extension ext. ''' - return os.path.join(self.destination_dir, self.basename(ext)) + return os.path.realpath(os.path.join(self.destination_dir, self.basename(ext))) def basename(self, ext): ''' @@ -638,6 +639,8 @@ class A2X(AttrDict): ''' docbook_file = self.dst_path('.xml') if self.skip_asciidoc: + if docbook_file != self.asciidoc_file: + shell_copy(self.asciidoc_file, docbook_file) if not os.path.isfile(docbook_file): die('missing docbook file: %s' % docbook_file) return -- cgit v1.2.1