Changeset 548

Show
Ignore:
Timestamp:
03/23/06 23:09:34 (3 years ago)
Author:
pkropf
Message:

GraphvizPlugin:

Corrected the regular expression for embedded URLs. Added default values for the cache manager control values. Commented out the various self.log.debug messages. Log the version of graphviz when GraphvizMacro? is initialized.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • graphvizplugin/branches/v0.6/graphviz/graphviz.py

    r533 r548  
    1010 
    1111 
    12 __version__   = '$LastChangedRevision$' 
     12__revision__  = '$LastChangedRevision$' 
    1313__id__        = '$Id$' 
    1414__headurl__   = '$HeadURL$' 
    1515__docformat__ = 'restructuredtext' 
     16__version__   = '0.6.1' 
    1617 
    1718 
     
    4647 
    4748    def __init__(self): 
    48         self.log.info('id: %s' % str(__id__)) 
    49         self.log.info('processors: %s' % str(GraphvizMacro.processors)) 
    50         self.log.info('formats: %s' % str(GraphvizMacro.formats)) 
     49        self.log.info('version: %s - id: %s' % (__version__, str(__id__))) 
     50        #self.log.info('processors: %s' % str(GraphvizMacro.processors)) 
     51        #self.log.info('formats: %s' % str(GraphvizMacro.formats)) 
    5152 
    5253 
     
    8990        """ 
    9091 
    91         self.log.debug('dir(req): %s' % str(dir(req))) 
    92         if hasattr(req, 'args'): 
    93             self.log.debug('req.args: %s' % str(req.args)) 
    94         else: 
    95             self.log.debug('req.args attribute does not exist') 
    96         if hasattr(req, 'base_url'): 
    97             self.log.debug('req.base_url: %s' % str(req.base_url)) 
    98         else: 
    99             self.log.debug('req.base_url attribute does not exist') 
     92        #self.log.debug('dir(req): %s' % str(dir(req))) 
     93        #if hasattr(req, 'args'): 
     94        #    self.log.debug('req.args: %s' % str(req.args)) 
     95        #else: 
     96        #    self.log.debug('req.args attribute does not exist') 
     97        #if hasattr(req, 'base_url'): 
     98        #    self.log.debug('req.base_url: %s' % str(req.base_url)) 
     99        #else: 
     100        #    self.log.debug('req.base_url attribute does not exist') 
    100101 
    101102        # check and load the configuration 
     
    156157            self.clean_cache() 
    157158 
    158             self.log.debug('render_macro.URL_in_graph: %s' % str(URL_in_graph)) 
     159            #self.log.debug('render_macro.URL_in_graph: %s' % str(URL_in_graph)) 
    159160            if URL_in_graph: # translate wiki TracLinks in URL 
    160                 content = re.sub(r'URL="(.*)"', self.expand_wiki_links, content) 
     161                content = re.sub(r'URL="(.*?)"', self.expand_wiki_links, content) 
     162 
    161163 
    162164            # Antialias PNGs with rsvg, if requested 
     
    164166                # 1. SVG output 
    165167                cmd = '"%s" %s -Tsvg -o%s.svg' % (proc_cmd, self.processor_options, img_path) 
    166                 self.log.debug('render_macro: running command %s' % cmd) 
     168                #self.log.debug('render_macro: running command %s' % cmd) 
    167169                out, err = self.launch(cmd, content) 
    168170                if len(out) or len(err): 
     
    171173                # 2. SVG to PNG rasterization 
    172174                cmd = '"%s" --dpi-x=%d --dpi-y=%d %s.svg %s' % (self.rsvg_path, self.dpi, self.dpi, img_path, img_path) 
    173                 self.log.debug('render_macro: running command %s' % cmd) 
     175                #self.log.debug('render_macro: running command %s' % cmd) 
    174176                out, err = self.launch(cmd, None) 
    175177                if len(out) or len(err): 
     
    179181            else: # Render other image formats 
    180182                cmd = '"%s" %s -T%s -o%s' % (proc_cmd, self.processor_options, self.out_format, img_path) 
    181                 self.log.debug('render_macro: running command %s' % cmd) 
     183                #self.log.debug('render_macro: running command %s' % cmd) 
    182184                out, err = self.launch(cmd, content) 
    183185                if len(out) or len(err): 
     
    191193                if not os.path.exists(map_path): 
    192194                    cmd = '"%s" %s -Tcmap -o%s' % (proc_cmd, self.processor_options, map_path) 
    193                     self.log.debug('render_macro: running command %s' % cmd) 
     195                    #self.log.debug('render_macro: running command %s' % cmd) 
    194196                    out, err = self.launch(cmd, content) 
    195197                    if len(out) or len(err): 
     
    236238 
    237239    def expand_wiki_links(self, match): 
    238         self.log.debug('expand_wiki_links.match.groups: %s' % str(match.groups())) 
     240        #self.log.debug('expand_wiki_links.match.groups: %s' % str(match.groups())) 
    239241         
    240242        wiki_url = match.groups()[0]                     # TracLink ([1], source:file/, ...) 
     
    243245         
    244246        url      = 'URL="%s"' % href.groups()[0] 
    245         self.log.debug('expand_wiki_links.url: %(url)s' % locals()) 
     247        #self.log.debug('expand_wiki_links.url: %(url)s' % locals()) 
    246248 
    247249        return url 
     
    272274                    buf = self.show_err(msg) 
    273275                    trouble = True 
    274                 self.log.debug('self.cache_dir: %s' % self.cache_dir) 
     276                #self.log.debug('self.cache_dir: %s' % self.cache_dir) 
    275277 
    276278            # check for the cmd_path entry 
     
    292294                        trouble = True 
    293295 
    294                 self.log.debug('self.cmd_path: %s' % self.cmd_path) 
     296                #self.log.debug('self.cmd_path: %s' % self.cmd_path) 
    295297 
    296298            # check for the prefix_url entry 
     
    301303            else: 
    302304                self.prefix_url = self.config.get('graphviz', 'prefix_url') 
    303                 self.log.debug('self.prefix_url: %s' % self.prefix_url) 
     305                #self.log.debug('self.prefix_url: %s' % self.prefix_url) 
    304306 
    305307 
     
    311313            else: 
    312314                self.out_format = GraphvizMacro.formats[0] 
    313             self.log.debug('self.out_format: %s' % self.out_format) 
     315            #self.log.debug('self.out_format: %s' % self.out_format) 
    314316 
    315317            # check for the default processor - processor 
     
    318320            else: 
    319321                self.processor = GraphvizMacro.processors[0] 
    320             self.log.debug('self.processor: %s' % self.processor) 
     322            #self.log.debug('self.processor: %s' % self.processor) 
    321323 
    322324            # check if png anti aliasing should be done - png_antialias 
     
    325327            else: 
    326328                self.png_anti_alias = False 
    327             self.log.debug('self.png_anti_alias: %s' % self.png_anti_alias) 
     329            #self.log.debug('self.png_anti_alias: %s' % self.png_anti_alias) 
    328330 
    329331            self.rsvg_path = '/usr/bin/rsvg' 
     
    336338                    buf = self.show_err(err) 
    337339                    trouble = True 
    338             self.log.debug('self.rsvg_path: %s' % self.rsvg_path) 
     340            #self.log.debug('self.rsvg_path: %s' % self.rsvg_path) 
    339341 
    340342            # get default graph/node/edge attributes 
     
    357359                self.cache_manager = True 
    358360 
    359                 self.cache_max_size  = int(self.config.get('graphviz', 'cache_max_size')) 
    360                 self.cache_min_size  = int(self.config.get('graphviz', 'cache_min_size')) 
    361                 self.cache_max_count = int(self.config.get('graphviz', 'cache_max_count')) 
    362                 self.cache_min_count = int(self.config.get('graphviz', 'cache_min_count')) 
    363  
    364                 self.log.debug('self.cache_max_count: %d' % self.cache_max_count) 
    365                 self.log.debug('self.cache_min_count: %d' % self.cache_min_count) 
    366                 self.log.debug('self.cache_max_size: %d'  % self.cache_max_size) 
    367                 self.log.debug('self.cache_min_size: %d'  % self.cache_min_size) 
     361                if self.config.parser.has_option('graphviz', 'cache_max_size'): 
     362                    self.cache_max_size  = int(self.config.get('graphviz', 'cache_max_size')) 
     363                else: 
     364                    self.cache_max_size = 10000000 
     365 
     366                if self.config.parser.has_option('graphviz', 'cache_min_size'): 
     367                    self.cache_min_size  = int(self.config.get('graphviz', 'cache_min_size')) 
     368                else: 
     369                    self.cache_min_size = 5000000 
     370 
     371                if self.config.parser.has_option('graphviz', 'cache_max_count'): 
     372                    self.cache_max_count = int(self.config.get('graphviz', 'cache_max_count')) 
     373                else: 
     374                    self.cache_max_count = 2000 
     375 
     376                if self.config.parser.has_option('graphviz', 'cache_min_count'): 
     377                    self.cache_min_count = int(self.config.get('graphviz', 'cache_min_count')) 
     378                else: 
     379                    self.cache_min_count = 1500 
     380 
     381                #self.log.debug('self.cache_max_count: %d' % self.cache_max_count) 
     382                #self.log.debug('self.cache_min_count: %d' % self.cache_min_count) 
     383                #self.log.debug('self.cache_max_size: %d'  % self.cache_max_size) 
     384                #self.log.debug('self.cache_min_size: %d'  % self.cache_min_size) 
    368385 
    369386            else: 
     
    429446 
    430447            for name in os.listdir(self.cache_dir): 
    431                 self.log.debug('clean_cache.entry: %s' % name) 
     448                #self.log.debug('clean_cache.entry: %s' % name) 
    432449                entry_list[name] = os.stat(os.path.join(self.cache_dir, name)) 
    433450 
     
    441458            atime_keys.sort() 
    442459 
    443             self.log.debug('clean_cache.atime_keys: %s' % atime_keys) 
    444             self.log.debug('clean_cache.count: %d' % count) 
    445             self.log.debug('clean_cache.size: %d' % size) 
     460            #self.log.debug('clean_cache.atime_keys: %s' % atime_keys) 
     461            #self.log.debug('clean_cache.count: %d' % count) 
     462            #self.log.debug('clean_cache.size: %d' % size) 
    446463         
    447464            # In the spirit of keeping the code fairly simple, the 
     
    454471                    key = atime_keys.pop(0) 
    455472                    for file in atime_list[key]: 
    456                         self.log.debug('clean_cache.unlink: %s' % file) 
     473                        #self.log.debug('clean_cache.unlink: %s' % file) 
    457474                        os.unlink(os.path.join(self.cache_dir, file)) 
    458475                        count = count - 1 
    459476                        size = size - entry_list[file][6] 
    460477        else: 
    461             self.log.debug('clean_cache: cache_manager not set') 
     478            #self.log.debug('clean_cache: cache_manager not set') 
     479            pass 
  • graphvizplugin/branches/v0.6/graphviz/__init__.py

    r156 r548  
    99 
    1010 
    11 __version__   = '$LastChangedRevision$' 
     11__revision__  = '$LastChangedRevision$' 
    1212__id__        = '$Id$' 
    1313__headurl__   = '$HeadURL$' 
  • graphvizplugin/branches/v0.6/ReleaseNotes.txt

    r533 r548  
    11Trac Graphviz Plugin v0.6 Release Notes 
    22======================================= 
    3 Mar 22, 2006 
     3Mar 23, 2006 
    44 
    5 Graphviz plugin v0.6 for Trac is now available. The Graphviz wiki 
     5Graphviz plugin v0.6.1 for Trac is now available. The Graphviz wiki 
    66processor is a plugin for Trac that allows the the dynamic generation 
    77of diagrams by the various graphviz programs. The text of a wiki page 
    88can contain the source text for graphviz and the web browser will show 
    99the resulting image. 
     10 
     11 
     12Changes for release v0.6.1 
     13-------------------------- 
     14 
     15* Applied patch from eblot to correct the regular expression for 
     16  embedded URLs. Resolves issue http://trac-hacks.org/ticket/161. 
     17 
     18* Renamed module variable __version__ to __revision__ to better 
     19  reflect the intent. 
     20 
     21* Moved the release version number from setup.py to 
     22  graphviz/graphviz.py. The version number is now logged when the 
     23  graphviz module is initialized. 
     24 
     25* Commented out the many self.log.debug messages. As pointed out in, 
     26  http://trac-hacks.org/ticket/238, the core seems to be mostly stable 
     27  and having lots and lots of debugging messages may no longer be 
     28  needed. 
     29 
     30* Added defaults for the cache management control values: 
     31 
     32  * cache_max_size = 10,000,000 
     33  * cache_min_size = 5,000,000 
     34  * cache_max_count = 2,000 
     35  * cache_min_count = 1,500 
     36 
     37  The resolves issue http://trac-hacks.org/ticket/160. 
    1038 
    1139 
     
    2452 
    2553Changes for release v0.5.1 
    26 ------------------------ 
     54-------------------------- 
    2755 
    2856 * Corrected typo in graphviz.py where the wrong internal variable was 
  • graphvizplugin/branches/v0.6/setup.py

    r214 r548  
    1616 
    1717from setuptools import setup, find_packages 
     18import graphviz 
    1819 
    1920setup ( 
    2021    name = 'graphviz', 
    21     version = "0.6"
     22    version = graphviz.graphviz.__version__
    2223    packages = find_packages(), 
    2324    package_data = { 'graphviz' : ['examples/*',],