def make_svn_version_py(self, delete=True):
target = njoin(self.local_path, '<STR_LIT>')<EOL>revision = self._get_svn_revision(self.local_path)<EOL>if os.path.isfile(target) or revision is None:<EOL><INDENT>return<EOL><DEDENT>else:<EOL><INDENT>def generate_svn_version_py():<EOL><INDENT>if not os.path.isfile(target):<EOL><INDENT>version = str(revision)<EOL>self.info('<STR_LIT>' % (target, version))<EOL>f = open(target, '<STR_LIT:w>')<EOL>f.write('<STR_LIT>' % (version))<EOL>f.close()<EOL><DEDENT>import atexit<EOL>def rm_file(f=target,p=self.info):<EOL><INDENT>if delete:<EOL><INDENT>try: os.remove(f); p('<STR_LIT>'+f)<EOL>except OSError: pass<EOL>try: os.remove(f+'<STR_LIT:c>'); p('<STR_LIT>'+f+'<STR_LIT:c>')<EOL>except OSError: pass<EOL><DEDENT><DEDENT>atexit.register(rm_file)<EOL>return target<EOL><DEDENT>self.add_data_files(('<STR_LIT>', generate_svn_version_py()))<EOL><DEDENT>
Appends a data function to the data_files list that will generate
        __svn_version__.py file to the current package directory.

        Generate package __svn_version__.py file from SVN revision number,
        it will be removed after python exits but will be available
        when sdist, etc commands are executed.

        Notes
        -----
        If __svn_version__.py existed before, nothing is done.

        This is
        intended for working with source directories that are in an SVN
        repository.