[pygccxml-commit] SF.net SVN: pygccxml: [829] website
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2007-01-02 08:18:16
|
Revision: 829
http://svn.sourceforge.net/pygccxml/?rev=829&view=rev
Author: roman_yakovenko
Date: 2007-01-02 00:18:14 -0800 (Tue, 02 Jan 2007)
Log Message:
-----------
small improvement
Modified Paths:
--------------
website/site_creator/environment.py
website/site_creator/utils.py
website/templates/online/page_template.html
Modified: website/site_creator/environment.py
===================================================================
--- website/site_creator/environment.py 2007-01-02 08:17:13 UTC (rev 828)
+++ website/site_creator/environment.py 2007-01-02 08:18:14 UTC (rev 829)
@@ -21,10 +21,12 @@
production_dir = os.path.join( os.path.split( sources_root )[0], 'production' )
production_www_dir = os.path.join( production_dir, 'www')
configuration_file = 'www_configuration'
- templates_dir = os.path.join( development_dir, 'templates', 'offline' )
+ #templates_dir = os.path.join( development_dir, 'templates', 'offline' )
templates_dir = os.path.join( development_dir, 'templates', 'online' )
site_css = 'language_binding.css'
home_url = 'http://www.language-binding.net'
+print settings.templates_dir
+
sys.path.append( os.path.join( settings.development_dir, 'tools', 'kid-svn-12-10-2006' ) )
sys.path.append( os.path.join( settings.development_dir, 'tools', 'pykleur-svn-11-11-2006' ) )
Modified: website/site_creator/utils.py
===================================================================
--- website/site_creator/utils.py 2007-01-02 08:17:13 UTC (rev 828)
+++ website/site_creator/utils.py 2007-01-02 08:18:14 UTC (rev 829)
@@ -1,146 +1,146 @@
-import os
-import sys
-import shutil
-import webbrowser
-from sets import Set as set
-from environment import settings
-
-class path:
- def normalize( some_path ):
- n = os.path.normpath( os.path.normcase( some_path ) )
- return n.replace( '\\', '/' )
- normalize = staticmethod( normalize )
-
- def is_parent_and_child( root_dir, child_dir ):
- root_dir = path.normalize( root_dir )
- child_dir = path.normalize( child_dir )
- return root_dir in child_dir and len( root_dir ) < len( child_dir )
- is_parent_and_child = staticmethod( is_parent_and_child )
-
- def is_same( path1, path2 ):
- path1 = path.normalize( path1 )
- path2 = path.normalize( path2 )
- return path1 == path2
- is_same = staticmethod( is_same )
-
- def suffix( root_dir, child_dir ):
- root_dir = path.normalize( root_dir )
- child_dir = path.normalize( child_dir )
- suffix = child_dir[ len( root_dir ): ]
- if suffix.startswith( '/' ):
- suffix = suffix[1:]
- return suffix
- suffix = staticmethod( suffix )
-
- def production_dir( development_dir ):
- development_dir = path.normalize( development_dir )
- suffix = path.suffix( settings.development_dir, development_dir )
- return path.normalize( os.path.join( settings.production_dir, suffix ) )
- production_dir = staticmethod( production_dir )
-
- def development_dir( production_dir ):
- production_dir = path.normalize( production_dir )
- suffix = path.suffix( settings.production_dir, production_dir )
- return path.normalize( os.path.join( settings.development_dir, suffix ) )
- development_dir = staticmethod( development_dir )
-
- def components( p ):
- answer = []
- root = p
- while root:
- root, leaf = os.path.split( root )
- if not leaf:
- answer.append( root )
- break
- else:
- answer.append( leaf )
-
- answer.reverse()
- return answer
-
- components = staticmethod( components )
-
- def common_prefix( path1, path2 ):
- #Returns common prefix of 2 pathes as os path
- common_prefix = ''
- comp1 = path.components(path1)
- comp2 = path.components(path2)
- for i in range( min( len( comp1 ), len( comp2 ) ) ):
- if comp1[i] != comp2[i]:
- if not i:
- return None
- else:
- return path.normalize( os.path.join( *comp1[:i] ) )
- else:
- if len( comp1 ) < len( comp2 ):
- return path.normalize( os.path.join( *comp1 ) )
- else:
- return path.normalize( os.path.join( *comp2 ) )
- common_prefix = staticmethod( common_prefix )
-
- def relative_path( from_path, to_path ):
- from_path = path.normalize( from_path )
- to_path = path.normalize( to_path )
- if from_path == to_path:
- return '.'
-
- common_prefix = path.common_prefix( from_path, to_path )
- if not common_prefix:
- return to_path #this could happen on windows machine
-
- comm_pref_components = path.components( common_prefix )
- fp_components = path.components( from_path )
- tp_components = path.components( to_path )
- if comm_pref_components == fp_components:
- return os.path.join( '.', *tp_components[ len( fp_components ): ] )
- else:
- #move up until common prefix
- temp = ['..'] * ( len( fp_components ) - len( comm_pref_components ) )
- #move down from common component
- temp.extend( tp_components[ len( comm_pref_components ): ] )
- relative_path = os.path.join( *temp )
- return relative_path.replace( '\\', '/' )
- relative_path = staticmethod( relative_path )
-
- def copytree(src, dst, symlinks=False):
- if not os.path.exists( dst ):
- os.mkdir(dst)
- for name in os.listdir(src):
- srcname = os.path.join(src, name)
- dstname = os.path.join(dst, name)
- if symlinks and os.path.islink(srcname):
- linkto = os.readlink(srcname)
- os.symlink(linkto, dstname)
- elif os.path.isdir(srcname):
- name_only = os.path.split( srcname )[1]
- if name.startswith('.'):
- continue
- path.copytree(srcname, dstname, symlinks)
- else:
- shutil.copy2(srcname, dstname)
- copytree = staticmethod( copytree )
-
-def preview_html( html ):
- f = os.path.join( settings.temp_dir, 'preview.html' )
- f = file( f, 'w+b' )
- f.write( html )
- f.close()
-
-def take_sys_snapshot():
- return dict( modules=set( sys.modules.keys() )
- , path=set( sys.path ) )
-
-def restore_sys_snapshot( snapshot ):
- new_modules = set( sys.modules.keys() ).difference( snapshot['modules'] )
- for x in new_modules:
- while x in sys.modules:
- sys.modules.pop( x )
- new_paths = set( sys.path ).difference( snapshot['path'] )
- for x in new_paths:
- while x in sys.path:
- sys.path.remove( x )
-
-if __name__ == '__main__':
- print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo\acmo.dsp', r'C:\AC_SERVER_III_V3_1\3rdParty\Boost' )
- print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo', r'C:\AC_SERVER_III_V3_1\acmo\xyz' )
-
\ No newline at end of file
+import os
+import sys
+import shutil
+import webbrowser
+from sets import Set as set
+from environment import settings
+
+class path:
+ def normalize( some_path ):
+ n = os.path.normpath( os.path.normcase( some_path ) )
+ return n.replace( '\\', '/' )
+ normalize = staticmethod( normalize )
+
+ def is_parent_and_child( root_dir, child_dir ):
+ root_dir = path.normalize( root_dir )
+ child_dir = path.normalize( child_dir )
+ return root_dir in child_dir and len( root_dir ) < len( child_dir )
+ is_parent_and_child = staticmethod( is_parent_and_child )
+
+ def is_same( path1, path2 ):
+ path1 = path.normalize( path1 )
+ path2 = path.normalize( path2 )
+ return path1 == path2
+ is_same = staticmethod( is_same )
+
+ def suffix( root_dir, child_dir ):
+ root_dir = path.normalize( root_dir )
+ child_dir = path.normalize( child_dir )
+ suffix = child_dir[ len( root_dir ): ]
+ if suffix.startswith( '/' ):
+ suffix = suffix[1:]
+ return suffix
+ suffix = staticmethod( suffix )
+
+ def production_dir( development_dir ):
+ development_dir = path.normalize( development_dir )
+ suffix = path.suffix( settings.development_dir, development_dir )
+ return path.normalize( os.path.join( settings.production_dir, suffix ) )
+ production_dir = staticmethod( production_dir )
+
+ def development_dir( production_dir ):
+ production_dir = path.normalize( production_dir )
+ suffix = path.suffix( settings.production_dir, production_dir )
+ return path.normalize( os.path.join( settings.development_dir, suffix ) )
+ development_dir = staticmethod( development_dir )
+
+ def components( p ):
+ answer = []
+ root = p
+ while root:
+ root, leaf = os.path.split( root )
+ if not leaf:
+ answer.append( root )
+ break
+ else:
+ answer.append( leaf )
+
+ answer.reverse()
+ return answer
+
+ components = staticmethod( components )
+
+ def common_prefix( path1, path2 ):
+ #Returns common prefix of 2 pathes as os path
+ common_prefix = ''
+ comp1 = path.components(path1)
+ comp2 = path.components(path2)
+ for i in range( min( len( comp1 ), len( comp2 ) ) ):
+ if comp1[i] != comp2[i]:
+ if not i:
+ return None
+ else:
+ return path.normalize( os.path.join( *comp1[:i] ) )
+ else:
+ if len( comp1 ) < len( comp2 ):
+ return path.normalize( os.path.join( *comp1 ) )
+ else:
+ return path.normalize( os.path.join( *comp2 ) )
+ common_prefix = staticmethod( common_prefix )
+
+ def relative_path( from_path, to_path ):
+ from_path = path.normalize( from_path )
+ to_path = path.normalize( to_path )
+ if from_path == to_path:
+ return '.'
+
+ common_prefix = path.common_prefix( from_path, to_path )
+ if not common_prefix:
+ return to_path #this could happen on windows machine
+
+ comm_pref_components = path.components( common_prefix )
+ fp_components = path.components( from_path )
+ tp_components = path.components( to_path )
+ if comm_pref_components == fp_components:
+ return os.path.join( '.', *tp_components[ len( fp_components ): ] )
+ else:
+ #move up until common prefix
+ temp = ['..'] * ( len( fp_components ) - len( comm_pref_components ) )
+ #move down from common component
+ temp.extend( tp_components[ len( comm_pref_components ): ] )
+ relative_path = os.path.join( *temp )
+ return relative_path.replace( '\\', '/' )
+ relative_path = staticmethod( relative_path )
+
+ def copytree(src, dst, symlinks=False):
+ if not os.path.exists( dst ):
+ os.makedirs(dst)
+ for name in os.listdir(src):
+ srcname = os.path.join(src, name)
+ dstname = os.path.join(dst, name)
+ if symlinks and os.path.islink(srcname):
+ linkto = os.readlink(srcname)
+ os.symlink(linkto, dstname)
+ elif os.path.isdir(srcname):
+ name_only = os.path.split( srcname )[1]
+ if name.startswith('.'):
+ continue
+ path.copytree(srcname, dstname, symlinks)
+ else:
+ shutil.copy2(srcname, dstname)
+ copytree = staticmethod( copytree )
+
+def preview_html( html ):
+ f = os.path.join( settings.temp_dir, 'preview.html' )
+ f = file( f, 'w+b' )
+ f.write( html )
+ f.close()
+
+def take_sys_snapshot():
+ return dict( modules=set( sys.modules.keys() )
+ , path=set( sys.path ) )
+
+def restore_sys_snapshot( snapshot ):
+ new_modules = set( sys.modules.keys() ).difference( snapshot['modules'] )
+ for x in new_modules:
+ while x in sys.modules:
+ sys.modules.pop( x )
+ new_paths = set( sys.path ).difference( snapshot['path'] )
+ for x in new_paths:
+ while x in sys.path:
+ sys.path.remove( x )
+
+if __name__ == '__main__':
+ print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo\acmo.dsp', r'C:\AC_SERVER_III_V3_1\3rdParty\Boost' )
+ print path.relative_path( r'C:\AC_SERVER_III_V3_1\acmo', r'C:\AC_SERVER_III_V3_1\acmo\xyz' )
+
Modified: website/templates/online/page_template.html
===================================================================
--- website/templates/online/page_template.html 2007-01-02 08:17:13 UTC (rev 828)
+++ website/templates/online/page_template.html 2007-01-02 08:18:14 UTC (rev 829)
@@ -26,7 +26,7 @@
</div>
<div class="right">
<!-- Google CSE Search Box Begins -->
- <form id="searchbox_017839341659215598962:rpxttlw8grw" action="http://www.google.com/cse">
+ <form action="http://www.google.com/cse" id="searchbox_017839341659215598962:rpxttlw8grw">
<input type="hidden" name="cx" value="017839341659215598962:rpxttlw8grw" />
<input name="q" type="text" size="25" />
<input type="submit" name="sa" value="Search" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|