Update of /cvsroot/pygccxml/source/release_manager
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1480/release_manager
Added Files:
clean_source_dir.py file_system_iter.py release_builder.py
setup_pygccxml.py setup_pyplusplus.py sf-how-to.txt
thanks_to.txt tools.txt
Log Message:
I hope those are last big changes in the project to this release.
Those changes give us an ability to create "setups" in one click
cd release_manager
python release_builder.py
Enjoy
--- NEW FILE: tools.txt ---
AdBlock
Add Bookmark Here
fireFTP
LinkChecker
Linky
--- NEW FILE: clean_source_dir.py ---
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
from file_system_iter import files_iterator, folders_iterator
to_be_deleted_file_exts = [
'*.pyc'
, '*.so'
, '*.os'
, '*.cpp~'
, '*.hpp~'
, '*.dll'
, '*.obj'
, '*.a'
, '*.def'
, '*.exp'
, '*.lib'
, '*.scons'
, '*.bak'
, '*.pdb'
, '*.htm'
, '*.idb'
, '*.pdb'
, '*.dat'
, '*.ncb'
]
to_be_deleted_files = [ '.sconsign' ]
if __name__ == '__main__':
sources_dir = os.path.join( os.path.abspath( os.curdir ), '..' )
for file in files_iterator( sources_dir, to_be_deleted_file_exts ):
print 'removing : ', file
os.remove( file )
for file in files_iterator( sources_dir ):
if os.path.split( file )[1] in to_be_deleted_files:
print 'removing : ', file
os.remove( file )
--- NEW FILE: sf-how-to.txt ---
How to load web pages on SF ?
Phil Schwartz wrote:
I will add it shortly. As for the SF website interface, perhaps I can
help a bit. It took me some time to figure it out, but I've been a SF
user for several years so I know a lot about their interface.
Basically, you need to ssh into your shell acount on SF. The easiest
way to do it is:
$ ssh rom...@py...
Once you're logged in (after supplying your password, of course).
You can then cd to your website directory:
$ cd /home/groups/p/py/pygccxml/htdocs
You can verify the existence of your web directory as such:
$ l -d /home/groups/p/py/pygccxml
You can then simply edit the index.html page with your favorite editor
(vi, emacs, pico, etc).
Additionally, you can edit the files on your local system and use scp to
transfer them to your project's homepage. This is the method that I use
to update my websites (kodos, releaseforge, scratchy, denyhosts, faqtor,
etc...).
cd www
scp * rom...@py...:/home/groups/p/py/pygccxml/htdocs
--- NEW FILE: file_system_iter.py ---
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
from types import *
##If you want include files that doesn't have extension then use filter like '*.'
def _make_list( argument ):
if type(argument) in StringTypes:
if argument:
return [argument]
else:
return []
elif type(argument) is ListType:
return argument
else:
raise TypeError( 'Argument "%s" must be or list of strings or string.' % argument )
class base_files_iterator:
def __init__(self, file_exts, is_include_exts = True):
self.__file_exts = _make_list( file_exts )
self.__is_include_exts = is_include_exts
def _is_to_skip(self, file_path):
if not self.__file_exts:
return 0
file_ext = os.path.splitext( file_path )[1]
if not file_ext:
file_ext = '.' + file_ext
file_ext = '*' + file_ext
if file_ext.lower() in self.__file_exts:
return not self.__is_include_exts
else:
return self.__is_include_exts
def _subfolders_and_files(self, folder_path):
files, folders = [], []
folder_contents = os.listdir(folder_path)
for object_name in folder_contents:
object_path = os.path.join(folder_path, object_name)
if os.path.isfile( object_path ) and not self._is_to_skip( object_path ):
files.append( object_path )
elif os.path.isdir( object_path ):
folders.append( object_path )
else:
pass
return folders, files
def __iter__(self):
raise NotImplementedError
def next(self):
raise NotImplementedError
def restart(self):
raise NotImplementedError
class files_iterator_generator(base_files_iterator):
def __init__(self, folders, file_ext_filter = '', is_include_filter = True, is_recursive = True):
base_files_iterator.__init__(self, file_ext_filter, is_include_filter)
self.__folders = _make_list( folders )
self.__is_recursive = is_recursive
self.__file_generator = None
def __walk(self):
folders = self.__folders[:]
while folders:
sub_folders, files = self._subfolders_and_files( folders.pop(0) )
if self.__is_recursive:
for folder in sub_folders:
folders.append( folder )
for file_os in files:
yield file_os
def __iter__(self):
self.__file_generator = self.__walk()
return self
def next(self):
return self.__file_generator.next()
def restart(self):
self.__file_generator = None
class folders_iterator_generator:
def __init__(self, folders, is_recursive = 1):
self.__folders = []
for root in _make_list( folders ):
self.__folders.extend( self.__sub_folders( root ) )
self.__is_recursive = is_recursive
self.__folder_generator = None
def __sub_folders(self, folder_path):
sub_folders = []
folder_contains = os.listdir(folder_path)
for object_in_folder in folder_contains:
full_path = os.path.join(folder_path, object_in_folder)
if os.path.isdir( full_path ):
sub_folders.append( full_path )
return sub_folders
def __walk(self):
folders = self.__folders[:]
for curr_folder in folders:
yield curr_folder
if self.__is_recursive:
for f in folders_iterator_generator( [curr_folder], True ):
yield f
def __iter__(self):
self.__folder_generator = self.__walk()
return self
def next(self):
return self.__folder_generator.next()
def restart(self):
self.__folder_generator = None
#preserving backward computability names
file_iter = files_iterator_generator
folder_iter = folders_iterator_generator
#new names
files_iterator = files_iterator_generator
folders_iterator = folders_iterator_generator
if '__main__' == __name__:
#lFileCount = 0
#for file_os in files_iterator( r'C:\Program Files\Microsoft Visual Studio\VC98\Include\stlport', ['*.h', '*.'], True, False):
#print file_os
#lFileCount += 1
#print lFileCount
for folder in folders_iterator( '/home/roman/language-binding', False ):
print folder
for folder in folders_iterator( '/home/roman/language-binding', True ):
print folder
--- NEW FILE: release_builder.py ---
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
import sys
import shutil
from sets import Set as set
from file_system_iter import files_iterator, folders_iterator
class release_builder_t( object ):
def __init__( self ):
object.__init__( self )
#source code root directory
self.scroot_dir, curr_dir = os.path.split( os.path.abspath( os.curdir ) )
#This file should be run from release_manager directory
if curr_dir != 'release_manager':
raise RuntimeError( 'Current working directory should be release_manager' )
#next release root dir
self.nrroot_dir = os.path.join( self.scroot_dir, '__next_release__' )
self.packages = {}
for pkg in ('pygccxml', 'pyplusplus'):
self.packages[ pkg ] = os.path.join( self.nrroot_dir
, pkg + self.get_version( pkg ) )
def get_version( self, package_name ):
init_file_path = os.path.join( self.scroot_dir, package_name, '__init__.py' )
init_file = file( init_file_path )
for line in init_file:
if line.startswith( '__version__' ):
version = line.split( '=' )[1]
return version.strip().strip("'")
raise RuntimeError( "Unable to find version for package %s!" % package_name )
def log( self, message ):
print '[release builder]', message
#def run_unitests( self ):
#self.log( 'running unittests' )
#for package in self.__packages:
#self.log( 'running unittests for package "%s"' % package.__name__ )
#sys_snapshot = self.__take_sys_snapshot()
#sys.path.append( os.path.join( package.__path__[0], 'unittests' ) )
#test_all = __import__( 'test_all' )
#was_successful = test_all.run_suite()
#self.__restore_sys_snapshot( sys_snapshot )
#if not was_successful:
#raise RuntimeError( '%s unittest failed' % package.__name__)
#self.log( 'running unittests - done' )
def create_dist_packages( self ):
self.log( 'creating next release directory "%s" ' % self.nrroot_dir )
if os.path.exists( self.nrroot_dir ):
shutil.rmtree( self.nrroot_dir )
os.mkdir( self.nrroot_dir )
map( os.mkdir, self.packages.values() )
for pkg, pkg_nr_dir in self.packages.items():
self.log( 'creating target directory for package "%s"' % pkg )
shutil.copy( os.path.join( self.scroot_dir, 'release_manager', 'setup_%s.py' % pkg )
, os.path.join( pkg_nr_dir, 'setup.py' ) )
pkg_nr_sc_dir = os.path.join( pkg_nr_dir, pkg )
shutil.copytree( os.path.join( self.scroot_dir, pkg ), pkg_nr_sc_dir )
pkg_nr_docs_dir = os.path.join( pkg_nr_dir, 'docs' )
shutil.copytree( os.path.join( self.scroot_dir, pkg, 'docs' ), pkg_nr_docs_dir )
shutil.rmtree( os.path.join( pkg_nr_sc_dir, 'docs' ) )
shutil.move( os.path.join( pkg_nr_sc_dir, 'unittests' )
, os.path.join( pkg_nr_dir, 'unittests' ) )
if pkg == 'pyplusplus':
shutil.move( os.path.join( pkg_nr_sc_dir, 'examples' )
, os.path.join( pkg_nr_dir, 'examples' ) )
shutil.rmtree( os.path.join( pkg_nr_sc_dir, 'experimental' ) )
shutil.rmtree( os.path.join( pkg_nr_docs_dir, 'ConferenceIsrael2006' ) )
shutil.rmtree( os.path.join( pkg_nr_dir, 'examples', 'tnfox' ) )
self.log( 'removing special directories')
def generate_docs(self):
self.log( 'generating documentation' )
options = [ '--output "%(output)s"'
, '--docformat epytext'
, '--url http://www.language-binding.net'
, '--name %(name)s'
, ' %(packages)s' ]
cmd_line = "epydoc " + ' '.join( options )
os.system(cmd_line % {
'output' : os.path.join( self.packages['pygccxml'], 'docs', 'auto_docs' )
, 'name' : 'pygccxml'
, 'packages' : os.path.join( self.packages['pygccxml'], 'pygccxml' )
} )
os.system(cmd_line % {
'output' : os.path.join( self.packages['pyplusplus'], 'docs', 'auto_docs' )
, 'name' : 'pyplusplus'
, 'packages' : ' '.join( [os.path.join( self.packages['pygccxml'], 'pygccxml' )
, os.path.join( self.packages['pyplusplus'], 'pyplusplus' ) ] )
} )
self.log( 'generating documentation - done' )
def clean_directories(self):
dir_names = [ 'cvs', 'temp', 'debug', 'release' ]
file_exts = [
'*.pyc', '*.so', '*.os', '*.cpp~', '*.hpp~', '*.dll', '*.obj', '*.a'
, '*.def', '*.vsd', '*.sxd', '*.exp', '*.lib', '*.scons', '*.bak'
, '*.pdb', '*.idb', '*.pdb', '*.dat', '*.ncb', '*.suo' ]
files = [ '.sconsign', 'place_holder', 'www_configuration.py' ]
self.log( 'creaning target directory' )
self.log( 'removing special directories')
tmp = []
for dir_ in folders_iterator( self.nrroot_dir ):
if os.path.split( dir_ )[1].lower() in dir_names:
tmp.append( dir_ )
tmp.sort()
tmp.reverse()
map( shutil.rmtree, tmp )
self.log( 'removing special directories - done')
self.log( 'removing special files')
map( os.remove, files_iterator( self.nrroot_dir, file_exts ) )
for file_ in files_iterator( self.nrroot_dir ):
if os.path.split( file_ )[1] in files:
os.remove( file_ )
self.log( 'removing special files - done')
self.log( 'creaning target directory - done' )
if __name__ == "__main__":
rb = release_builder_t()
#srb.run_unitests()
rb.create_dist_packages()
rb.generate_docs()
rb.clean_directories()
--- NEW FILE: thanks_to.txt ---
Yulia
- my wife for patience
Brad King
- the author of GCCXML
Thomas Heller
- good SAX example
Detlev Offenbach
- eric3 - Python IDE
--- NEW FILE: setup_pygccxml.py ---
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
from distutils import sysconfig
from distutils.core import setup
setup( name="pygccxml"
, description="GCC-XML generated file reader"
, author="Roman Yakovenko"
, packages=[ 'pygccxml'
, 'pygccxml.declarations'
, 'pygccxml.parser'
, 'pygccxml.utils' ]
)
--- NEW FILE: setup_pyplusplus.py ---
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
from distutils import sysconfig
from distutils.core import setup
setup( name="pyplusplus"
, description="pyplusplus is a framework of components for creating C++ code generator for boost.python library"
, author="Roman Yakovenko"
, author_email="rom...@gm..."
, url='http://pyplusplus.sourceforge.net'
, scripts=os.listdir( os.path.join( 'pyplusplus', 'scripts' ) )
, packages=[ 'pyplusplus'
, 'pyplusplus.gui'
, 'pyplusplus.file_writers'
, 'pyplusplus.code_creators'
, 'pyplusplus.module_creator'
, 'pyplusplus.code_repository'
, 'pyplusplus.decl_wrappers'
, 'pyplusplus.module_builder'
, 'pyplusplus.utils'
, 'pyplusplus._logging_']
)
|