yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #12809
[Branch ~yade-pkg/yade/git-trunk] Rev 3925: Remove some deprecated scripts.
------------------------------------------------------------
revno: 3925
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Wed 2016-08-10 22:37:12 +0200
message:
Remove some deprecated scripts.
removed:
scripts/HTML.py
scripts/default-test.py
scripts/hackett-warn-replace.py
scripts/hackett.py
scripts/installOnUbuntu.sh
scripts/make-release.sh
scripts/regression-tests.py
scripts/scanreplace.py
scripts/yade-exec-wrapper
scripts/ysl1.py
modified:
lib/serialization/Serializable.cpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'lib/serialization/Serializable.cpp'
--- lib/serialization/Serializable.cpp 2014-05-23 13:03:50 +0000
+++ lib/serialization/Serializable.cpp 2016-08-10 20:37:12 +0000
@@ -18,12 +18,10 @@
.def("__str__",&Serializable::pyStr).def("__repr__",&Serializable::pyStr)
.def("dict",&Serializable::pyDict,"Return dictionary of attributes.")
.def("updateAttrs",&Serializable::pyUpdateAttrs,"Update object attributes from given dictionary")
- #if 1
/* boost::python pickling support, as per http://www.boost.org/doc/libs/1_42_0/libs/python/doc/v2/pickle.html */
.def("__getstate__",&Serializable::pyDict).def("__setstate__",&Serializable::pyUpdateAttrs)
.add_property("__safe_for_unpickling__",&Serializable::getClassName,"just define the attr, return some bogus data")
.add_property("__getstate_manages_dict__",&Serializable::getClassName,"just define the attr, return some bogus data")
- #endif
// constructor with dictionary of attributes
.def("__init__",boost::python::raw_constructor(Serializable_ctor_kwAttrs<Serializable>))
// comparison operators
=== removed file 'scripts/HTML.py'
--- scripts/HTML.py 2012-03-13 15:23:04 +0000
+++ scripts/HTML.py 1970-01-01 00:00:00 +0000
@@ -1,493 +0,0 @@
-#!/usr/bin/python
-# -*- coding: iso-8859-1 -*-
-"""
-HTML.py - v0.04 2009-07-28 Philippe Lagadec
-
-This module provides a few classes to easily generate HTML code such as tables
-and lists.
-
-Project website: http://www.decalage.info/python/html
-
-License: CeCILL (open-source GPL compatible), see source code for details.
- http://www.cecill.info
-"""
-
-__version__ = '0.04'
-__date__ = '2009-07-28'
-__author__ = 'Philippe Lagadec'
-
-#--- LICENSE ------------------------------------------------------------------
-
-# Copyright Philippe Lagadec - see http://www.decalage.info/contact for contact info
-#
-# This module provides a few classes to easily generate HTML tables and lists.
-#
-# This software is governed by the CeCILL license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/or redistribute the software under the terms of the CeCILL
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# "http://www.cecill.info".
-#
-# A copy of the CeCILL license is also provided in these attached files:
-# Licence_CeCILL_V2-en.html and Licence_CeCILL_V2-fr.html
-#
-# As a counterpart to the access to the source code and rights to copy,
-# modify and redistribute granted by the license, users are provided only
-# with a limited warranty and the software's author, the holder of the
-# economic rights, and the successive licensors have only limited
-# liability.
-#
-# In this respect, the user's attention is drawn to the risks associated
-# with loading, using, modifying and/or developing or reproducing the
-# software by the user in light of its specific status of free software,
-# that may mean that it is complicated to manipulate, and that also
-# therefore means that it is reserved for developers and experienced
-# professionals having in-depth computer knowledge. Users are therefore
-# encouraged to load and test the software's suitability as regards their
-# requirements in conditions enabling the security of their systems and/or
-# data to be ensured and, more generally, to use and operate it in the
-# same conditions as regards security.
-#
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL license and that you accept its terms.
-
-
-#--- CHANGES ------------------------------------------------------------------
-
-# 2008-10-06 v0.01 PL: - First version
-# 2008-10-13 v0.02 PL: - added cellspacing and cellpadding to table
-# - added functions to ease one-step creation of tables
-# and lists
-# 2009-07-21 v0.03 PL: - added column attributes and styles (first attempt)
-# (thanks to an idea submitted by Michal Cernoevic)
-# 2009-07-28 v0.04 PL: - improved column styles, workaround for Mozilla
-
-
-#-------------------------------------------------------------------------------
-#TODO:
-# - method to return a generator (yield each row) instead of a single string
-# - unicode support (input and output)
-# - escape text in cells (optional)
-# - constants for standard colors
-# - use lxml to generate well-formed HTML ?
-# - add classes/functions to generate a HTML page, paragraphs, headings, etc...
-
-
-#--- THANKS --------------------------------------------------------------------
-
-# - Michal Cernoevic, for the idea of column styles.
-
-#--- REFERENCES ----------------------------------------------------------------
-
-# HTML 4.01 specs: http://www.w3.org/TR/html4/struct/tables.html
-
-# Colors: http://www.w3.org/TR/html4/types.html#type-color
-
-# Columns alignement and style, one of the oldest and trickiest bugs in Mozilla:
-# https://bugzilla.mozilla.org/show_bug.cgi?id=915
-
-
-#--- CONSTANTS -----------------------------------------------------------------
-
-# Table style to get thin black lines in Mozilla/Firefox instead of 3D borders
-TABLE_STYLE_THINBORDER = "border: 1px solid #000000; border-collapse: collapse;"
-#TABLE_STYLE_THINBORDER = "border: 1px solid #000000;"
-
-
-#=== CLASSES ===================================================================
-
-class TableCell (object):
- """
- a TableCell object is used to create a cell in a HTML table. (TD or TH)
-
- Attributes:
- - text: text in the cell (may contain HTML tags). May be any object which
- can be converted to a string using str().
- - header: bool, false for a normal data cell (TD), true for a header cell (TH)
- - bgcolor: str, background color
- - width: str, width
- - align: str, horizontal alignement (left, center, right, justify or char)
- - char: str, alignment character, decimal point if not specified
- - charoff: str, see HTML specs
- - valign: str, vertical alignment (top|middle|bottom|baseline)
- - style: str, CSS style
- - attribs: dict, additional attributes for the TD/TH tag
-
- Reference: http://www.w3.org/TR/html4/struct/tables.html#h-11.2.6
- """
-
- def __init__(self, text="", bgcolor=None, header=False, width=None,
- align=None, char=None, charoff=None, valign=None, style=None,
- attribs=None):
- """TableCell constructor"""
- self.text = text
- self.bgcolor = bgcolor
- self.header = header
- self.width = width
- self.align = align
- self.char = char
- self.charoff = charoff
- self.valign = valign
- self.style = style
- self.attribs = attribs
- if attribs==None:
- self.attribs = {}
-
- def __str__(self):
- """return the HTML code for the table cell as a string"""
- attribs_str = ""
- if self.bgcolor: self.attribs['bgcolor'] = self.bgcolor
- if self.width: self.attribs['width'] = self.width
- if self.align: self.attribs['align'] = self.align
- if self.char: self.attribs['char'] = self.char
- if self.charoff: self.attribs['charoff'] = self.charoff
- if self.valign: self.attribs['valign'] = self.valign
- if self.style: self.attribs['style'] = self.style
- for attr in self.attribs:
- attribs_str += ' %s="%s"' % (attr, self.attribs[attr])
- if self.text:
- text = str(self.text)
- else:
- # An empty cell should at least contain a non-breaking space
- text = ' '
- if self.header:
- return ' <TH%s>%s</TH>\n' % (attribs_str, text)
- else:
- return ' <TD%s>%s</TD>\n' % (attribs_str, text)
-
-#-------------------------------------------------------------------------------
-
-class TableRow (object):
- """
- a TableRow object is used to create a row in a HTML table. (TR tag)
-
- Attributes:
- - cells: list, tuple or any iterable, containing one string or TableCell
- object for each cell
- - header: bool, true for a header row (TH), false for a normal data row (TD)
- - bgcolor: str, background color
- - col_align, col_valign, col_char, col_charoff, col_styles: see Table class
- - attribs: dict, additional attributes for the TR tag
-
- Reference: http://www.w3.org/TR/html4/struct/tables.html#h-11.2.5
- """
-
- def __init__(self, cells=None, bgcolor=None, header=False, attribs=None,
- col_align=None, col_valign=None, col_char=None,
- col_charoff=None, col_styles=None):
- """TableCell constructor"""
- self.bgcolor = bgcolor
- self.cells = cells
- self.header = header
- self.col_align = col_align
- self.col_valign = col_valign
- self.col_char = col_char
- self.col_charoff = col_charoff
- self.col_styles = col_styles
- self.attribs = attribs
- if attribs==None:
- self.attribs = {}
-
- def __str__(self):
- """return the HTML code for the table row as a string"""
- attribs_str = ""
- if self.bgcolor: self.attribs['bgcolor'] = self.bgcolor
- for attr in self.attribs:
- attribs_str += ' %s="%s"' % (attr, self.attribs[attr])
- result = ' <TR%s>\n' % attribs_str
- for cell in self.cells:
- col = self.cells.index(cell) # cell column index
- if not isinstance(cell, TableCell):
- cell = TableCell(cell, header=self.header)
- # apply column alignment if specified:
- if self.col_align and cell.align==None:
- cell.align = self.col_align[col]
- if self.col_char and cell.char==None:
- cell.char = self.col_char[col]
- if self.col_charoff and cell.charoff==None:
- cell.charoff = self.col_charoff[col]
- if self.col_valign and cell.valign==None:
- cell.valign = self.col_valign[col]
- # apply column style if specified:
- if self.col_styles and cell.style==None:
- cell.style = self.col_styles[col]
- result += str(cell)
- result += ' </TR>\n'
- return result
-
-#-------------------------------------------------------------------------------
-
-class Table (object):
- """
- a Table object is used to create a HTML table. (TABLE tag)
-
- Attributes:
- - rows: list, tuple or any iterable, containing one iterable or TableRow
- object for each row
- - header_row: list, tuple or any iterable, containing the header row (optional)
- - border: str or int, border width
- - style: str, table style in CSS syntax (thin black borders by default)
- - width: str, width of the table on the page
- - attribs: dict, additional attributes for the TABLE tag
- - col_width: list or tuple defining width for each column
- - col_align: list or tuple defining horizontal alignment for each column
- - col_char: list or tuple defining alignment character for each column
- - col_charoff: list or tuple defining charoff attribute for each column
- - col_valign: list or tuple defining vertical alignment for each column
- - col_styles: list or tuple of HTML styles for each column
-
- Reference: http://www.w3.org/TR/html4/struct/tables.html#h-11.2.1
- """
-
- def __init__(self, rows=None, border='1', style=None, width=None,
- cellspacing=None, cellpadding=4, attribs=None, header_row=None,
- col_width=None, col_align=None, col_valign=None,
- col_char=None, col_charoff=None, col_styles=None):
- """TableCell constructor"""
- self.border = border
- self.style = style
- # style for thin borders by default
- if style == None: self.style = TABLE_STYLE_THINBORDER
- self.width = width
- self.cellspacing = cellspacing
- self.cellpadding = cellpadding
- self.header_row = header_row
- self.rows = rows
- if not rows: self.rows = []
- self.attribs = attribs
- if not attribs: self.attribs = {}
- self.col_width = col_width
- self.col_align = col_align
- self.col_char = col_char
- self.col_charoff = col_charoff
- self.col_valign = col_valign
- self.col_styles = col_styles
-
- def __str__(self):
- """return the HTML code for the table as a string"""
- attribs_str = ""
- if self.border: self.attribs['border'] = self.border
- if self.style: self.attribs['style'] = self.style
- if self.width: self.attribs['width'] = self.width
- if self.cellspacing: self.attribs['cellspacing'] = self.cellspacing
- if self.cellpadding: self.attribs['cellpadding'] = self.cellpadding
- for attr in self.attribs:
- attribs_str += ' %s="%s"' % (attr, self.attribs[attr])
- result = '<TABLE%s>\n' % attribs_str
- # insert column tags and attributes if specified:
- if self.col_width:
- for width in self.col_width:
- result += ' <COL width="%s">\n' % width
- # The following code would also generate column attributes for style
- # and alignement according to HTML4 specs,
- # BUT it is not supported completely (only width) on Mozilla Firefox:
- # see https://bugzilla.mozilla.org/show_bug.cgi?id=915
-## n_cols = max(len(self.col_styles), len(self.col_width),
-## len(self.col_align), len(self.col_valign))
-## for i in range(n_cols):
-## col = ''
-## try:
-## if self.col_styles[i]:
-## col += ' style="%s"' % self.col_styles[i]
-## except: pass
-## try:
-## if self.col_width[i]:
-## col += ' width="%s"' % self.col_width[i]
-## except: pass
-## try:
-## if self.col_align[i]:
-## col += ' align="%s"' % self.col_align[i]
-## except: pass
-## try:
-## if self.col_valign[i]:
-## col += ' valign="%s"' % self.col_valign[i]
-## except: pass
-## result += '<COL%s>\n' % col
- # First insert a header row if specified:
- if self.header_row:
- if not isinstance(self.header_row, TableRow):
- result += str(TableRow(self.header_row, header=True))
- else:
- result += str(self.header_row)
- # Then all data rows:
- for row in self.rows:
- if not isinstance(row, TableRow):
- row = TableRow(row)
- # apply column alignments and styles to each row if specified:
- # (Mozilla bug workaround)
- if self.col_align and not row.col_align:
- row.col_align = self.col_align
- if self.col_char and not row.col_char:
- row.col_char = self.col_char
- if self.col_charoff and not row.col_charoff:
- row.col_charoff = self.col_charoff
- if self.col_valign and not row.col_valign:
- row.col_valign = self.col_valign
- if self.col_styles and not row.col_styles:
- row.col_styles = self.col_styles
- result += str(row)
- result += '</TABLE>'
- return result
-
-
-#-------------------------------------------------------------------------------
-
-class List (object):
- """
- a List object is used to create an ordered or unordered list in HTML.
- (UL/OL tag)
-
- Attributes:
- - lines: list, tuple or any iterable, containing one string for each line
- - ordered: bool, choice between an ordered (OL) or unordered list (UL)
- - attribs: dict, additional attributes for the OL/UL tag
-
- Reference: http://www.w3.org/TR/html4/struct/lists.html
- """
-
- def __init__(self, lines=None, ordered=False, start=None, attribs=None):
- """List constructor"""
- if lines:
- self.lines = lines
- else:
- self.lines = []
- self.ordered = ordered
- self.start = start
- if attribs:
- self.attribs = attribs
- else:
- self.attribs = {}
-
- def __str__(self):
- """return the HTML code for the list as a string"""
- attribs_str = ""
- if self.start: self.attribs['start'] = self.start
- for attr in self.attribs:
- attribs_str += ' %s="%s"' % (attr, self.attribs[attr])
- if self.ordered: tag = 'OL'
- else: tag = 'UL'
- result = '<%s%s>\n' % (tag, attribs_str)
- for line in self.lines:
- result += ' <LI>%s\n' % str(line)
- result += '</%s>\n' % tag
- return result
-
-
-##class Link (object):
-## """
-## a Link object is used to create link in HTML. (<a> tag)
-##
-## Attributes:
-## - text: str, text of the link
-## - url: str, URL of the link
-## - attribs: dict, additional attributes for the A tag
-##
-## Reference: http://www.w3.org/TR/html4
-## """
-##
-## def __init__(self, text, url=None, attribs=None):
-## """Link constructor"""
-## self.text = text
-## self.url = url
-## if attribs:
-## self.attribs = attribs
-## else:
-## self.attribs = {}
-##
-## def __str__(self):
-## """return the HTML code for the link as a string"""
-## attribs_str = ""
-## if self.url: self.attribs['href'] = self.url
-## for attr in self.attribs:
-## attribs_str += ' %s="%s"' % (attr, self.attribs[attr])
-## return '<a%s>%s</a>' % (attribs_str, text)
-
-
-#=== FUNCTIONS ================================================================
-
-# much simpler definition of a link as a function:
-def Link(text, url):
- return '<a href="%s">%s</a>' % (url, text)
-
-def link(text, url):
- return '<a href="%s">%s</a>' % (url, text)
-
-def table(*args, **kwargs):
- 'return HTML code for a table as a string. See Table class for parameters.'
- return str(Table(*args, **kwargs))
-
-def list(*args, **kwargs):
- 'return HTML code for a list as a string. See List class for parameters.'
- return str(List(*args, **kwargs))
-
-
-#=== MAIN =====================================================================
-
-# Show sample usage when this file is launched as a script.
-
-if __name__ == '__main__':
-
- # open an HTML file to show output in a browser
- f = open('test.html', 'w')
-
- t = Table()
- t.rows.append(TableRow(['A', 'B', 'C'], header=True))
- t.rows.append(TableRow(['D', 'E', 'F']))
- t.rows.append(('i', 'j', 'k'))
- f.write(str(t) + '<p>\n')
- print str(t)
- print '-'*79
-
- t2 = Table([
- ('1', '2'),
- ['3', '4']
- ], width='100%', header_row=('col1', 'col2'),
- col_width=('', '75%'))
- f.write(str(t2) + '<p>\n')
- print t2
- print '-'*79
-
- t2.rows.append(['5', '6'])
- t2.rows[1][1] = TableCell('new', bgcolor='red')
- t2.rows.append(TableRow(['7', '8'], attribs={'align': 'center'}))
- f.write(str(t2) + '<p>\n')
- print t2
- print '-'*79
-
- # sample table with column attributes and styles:
- table_data = [
- ['Smith', 'John', 30, 4.5],
- ['Carpenter', 'Jack', 47, 7],
- ['Johnson', 'Paul', 62, 10.55],
- ]
- htmlcode = HTML.table(table_data,
- header_row = ['Last name', 'First name', 'Age', 'Score'],
- col_width=['', '20%', '10%', '10%'],
- col_align=['left', 'center', 'right', 'char'],
- col_styles=['font-size: large', '', 'font-size: small', 'background-color:yellow'])
- f.write(htmlcode + '<p>\n')
- print htmlcode
- print '-'*79
-
- def gen_table_squares(n):
- """
- Generator to create table rows for integers from 1 to n
- """
-## # First, header row:
-## yield TableRow(('x', 'square(x)'), header=True, bgcolor='blue')
-## # Then all rows:
- for x in range(1, n+1):
- yield (x, x*x)
-
- t = Table(rows=gen_table_squares(10), header_row=('x', 'square(x)'))
- f.write(str(t) + '<p>\n')
-
- print '-'*79
- l = List(['aaa', 'bbb', 'ccc'])
- f.write(str(l) + '<p>\n')
- l.ordered = True
- f.write(str(l) + '<p>\n')
- l.start=10
- f.write(str(l) + '<p>\n')
-
- f.close()
=== removed file 'scripts/default-test.py'
--- scripts/default-test.py 2009-12-13 19:27:57 +0000
+++ scripts/default-test.py 1970-01-01 00:00:00 +0000
@@ -1,110 +0,0 @@
-#!/usr/local/bin/yade-trunk
-# coding=UTF-8
-# this must be run inside yade
-#
-# pass 'mail:sender@xxxxxxxxxxxxx,recipient@xxxxxxxxxxxxx' as an argument so that the crash report is e-mailed
-# using the default SMTP settings (sendmail?) on your system
-#
-import os,time,sys
-from yade import *
-import yade.runtime,yade.system,yade.config
-simulFile='/tmp/yade-test-%d.xml'%(os.getpid()) # generated simulations here
-pyCmdFile='/tmp/yade-test-%d.py'%(os.getpid()) # generated script here
-msgFile='/tmp/yade-test-%d.msg'%(os.getpid()) # write message here
-runSimul="""
-# generated file
-from yade import *
-simulFile='%s'; msgFile='%s'; nIter=%d;
-import time
-try:
- O.load(simulFile)
- O.run(10); O.wait() # run first 10 iterations
- start=time.time(); O.run(nIter); O.wait(); finish=time.time() # run nIter iterations, wait to finish, measure elapsed time
- speed=nIter/(finish-start); open(msgFile,'w').write('%%g iter/sec'%%speed)
-except:
- import sys, traceback
- traceback.print_exc()
- sys.exit(1)
-print 'main: Yade: normal exit.'
-O.exitNoBacktrace()
-quit()
-"""%(simulFile,msgFile,100)
-
-runGenerator="""
-#generated file
-from yade import *
-%%s(%%s).generate('%s')
-print 'main: Yade: normal exit.'
-O.exitNoBacktrace()
-quit()
-"""%(simulFile)
-
-
-def crashProofRun(cmd,quiet=True):
- import subprocess,os,os.path,yade.runtime
- f=open(pyCmdFile,'w'); f.write(cmd); f.close();
- if os.path.exists(msgFile): os.remove(msgFile)
- p=subprocess.Popen([sys.executable,pyCmdFile],stdout=subprocess.PIPE,stderr=subprocess.STDOUT,env=dict(os.environ,**{'PYTHONPATH':os.path.join(yade.config.prefix,'lib','yade'+yade.config.suffix,'py'),'DISPLAY':''}))
- pout=p.communicate()[0]
- retval=p.wait()
- if not quiet: print pout
- msg=''
- if os.path.exists(msgFile): msg=open(msgFile,'r').readlines()[0]
- if retval==0: return True,msg,pout
- else:
- # handle crash at exit :-(
- if 'main: Yade: normal exit.' in pout: return True,msg,pout
- return False,msg,pout
-
-reports=[]
-summary=[]
-#broken=['SDECLinkedSpheres','SDECMovingWall','SDECSpheresPlane','ThreePointBending']
-broken=[]
-genParams={
- #'USCTGen':{'spheresFile':'examples/small.sdec.xyz'}
-}
-
-for pp in yade.system.childClasses('FileGenerator'):
- if pp in broken:
- summary.append(pp,'skipped (broken)','');
- params='' if pp not in genParams else (","+",".join(["%s=%s"%(k,repr(genParams[pp][k])) for k in genParams[pp]]))
- ok1,msg1,out1=crashProofRun(runGenerator%(pp,params))
- if not ok1:
- reports.append([pp,'generator CRASH',out1]); summary.append([pp,'generator CRASH'])
- else:
- ok2,msg2,out2=crashProofRun(runSimul)
- if not ok2: reports.append([pp,'simulation CRASH',out2]); summary.append([pp,'simulation CRASH'])
- else: summary.append([pp,'passed (%s)'%msg2])
- print summary[-1][0]+':',summary[-1][1]
-
-# delete temporaries
-for f in simulFile,msgFile,pyCmdFile:
- if os.path.exists(f): os.remove(f)
-
-# handle crash reports, if any
-if reports:
- mailFrom,mailTo=None,None
- for a in yade.runtime.argv:
- if 'mail:' in a: mailFrom,mailTo=a.replace('mail:','').split(',')
- reportText='\n'.join([80*'#'+'\n'+r[0]+': '+r[1]+'\n'+80*'#'+'\n'+r[2] for r in reports])
- if mailTo and mailFrom:
- from email.mime.text import MIMEText
- import yade.config
- msg=MIMEText(reportText)
- msg['Subject']="Automated crash report for Yade "+yade.config.revision+": "+",".join([r[0] for r in reports])
- msg['From']=mailFrom
- msg['To']=mailTo
- msg['Reply-To']='yade-dev@xxxxxxxxxxxxxxxxxxx'
- import smtplib
- s=smtplib.SMTP()
- s.connect()
- s.sendmail(mailFrom,[mailTo],msg.as_string())
- s.close()
- print "Sent crash report to ",mailTo
- else:
- print "\n\n=================================== PROBLEM DETAILS ===================================\n"
- print reportText
-
-print "\n\n========================================= SUMMARY ======================================\n"
-for l in summary: print "%30s: %s"%(l[0],l[1])
-quit()
=== removed file 'scripts/hackett-warn-replace.py'
--- scripts/hackett-warn-replace.py 2010-04-25 15:46:26 +0000
+++ scripts/hackett-warn-replace.py 1970-01-01 00:00:00 +0000
@@ -1,205 +0,0 @@
-#!/usr/bin/env python
-
-# This scripts attempts to replace deprecated symbols by their new equivalents based on compiler's output log. Symbol map must be
-# given explicitly (see renamedSymbols below).
-#
-# The only command-line argument is yade's buildRoot (trunk) directory. This script further on the fact that all filenames reported
-# in compiler's warnings are relative to the buildRoot. Therefore, you better use scons to compile, since default Makefile are recursive.
-#
-# Build log (like "scons >build.log 2>&1") is piped from standard input. It MUST be strictly sequential, i.e. no -j2 etc.
-#
-# You may have to adjust the runCxxPattern below depending on the compiler you use. It must distinguish a compiler invocation.
-runCxxPattern=r'^((c|g|so)\+\+|ccache|distcc).*$'
-#
-# Likewise for deprecatedPattern. It must have the following groups: file, line, symbol.
-# This one works for g++4.0 and possibly other compilers.
-deprecatedPattern=r"^(.*?):([0-9]+): warning: '.*<[a-zA-Z]*>::([a-zA-Z0-9_]+)(\(.*'|') is deprecated.*$"
-#
-# All files modified are backed up to their directory with some extension like .~undeprecated~.
-#
-
-
-import sys
-from re import *
-import logging
-from os.path import join
-import os.path
-import shutil
-from pprint import pprint
-
-logging.basicConfig(level=logging.DEBUG)
-
-#
-# these symbols are class methods. Several of them are the same (like Vector{2,3}.x()), but they have been
-# fortunately renamed the same for all classes. So we don't need to distinguish that.
-#
-# the dictionary was generated by hackett2.py from tags files
-#
-renamedSymbols={
- 'ZERO':'Zero()',
- 'UNIT_X':'UnitX()',
- 'UNIT_Y':'UnitY()',
- 'UNIT_Z':'UnitZ()',
- 'ONE':'Ones()',
- 'W':'w',
- 'X':'x',
- 'Y':'y',
- 'Z':'z',
- 'Cross':'cross',
- 'Dot':'dot',
- 'Conjugate':'conjugate',
- 'Inverse':'inverse',
- 'Determinant':'determinant',
- 'Transpose':'transpose',
- 'Length':'norm',
- 'SquaredLength':'squaredNorm',
- 'Align':'setFromTwoVectors',
- }
-
-# places where deprecated methods are used
-# keys are symbols, value is a list of (file,line,count)
-# this is the global dictionary
-D={}
-# dtto, but for one individual compiler run; changes are merged to D afterwards
-D1={}
-# count of deprecation warnings, only for the heck of informing the user of what is going on
-Dcount=0
-
-
-# Symbols at different lines than the compiler reports.
-# Maps (symbol,file,line_as_reported_by_compiler) -> real_line.
-# We are not intelligent enough to do fuzzy match on line number.
-Doffsets={}
-# {('sqRoot','include/yade/yade-lib-wm3-math/Quaternion.ipp',459):455,
-# ('sqRoot','include/yade/yade-lib-wm3-math/Vector3.ipp',270):267,
-# ('x','include/yade/yade-lib-serialization/KnownFundamentalsHandler.tpp',187):188,
-# ('y','include/yade/yade-lib-serialization/KnownFundamentalsHandler.tpp',187):190,
-# ('z','include/yade/yade-lib-serialization/KnownFundamentalsHandler.tpp',187):192,
-# ('sqRoot','include/yade/yade-lib-wm3-math/Vector2.ipp',243):241}
-
-unknownDeprec=set()
-
-# parse the build log as fed by stdin
-for l in sys.stdin.xreadlines():
- if match(runCxxPattern,l): #initialization, i.e. the compiler being run; until the next compiler run or EOF, all messages belong to this compilation.
- # merge dictonary from the previous compiler run
- for s in D1.keys():
- if not s in D.keys(): # new symbol; simply add
- D[s]=D1[s]
- continue
- # OK, now s is in D already
- for ss1 in D1[s]: # iterate over locations for symbol s from this compilation
- done=False # tmp to break the outer loop from the nested one
- for ss in D[s]: # iterate over locations from all previous compilations
- if ss[0]!=ss1[0]: continue # file doesn't match, doesn't belong here
- if ss[1]!=ss1[1]: continue # line doesn't match, dtto
- # here, symbol, file, and line match. Make sure that count also matches. It should.
- if ss[2]==ss1[2]: # this is OK. Last compilation all report that symbol the same number of times for that line
- done=True
- else:
- logging.error("%s:%d: Deprecations warning number doesn't match for `%s'"%(f,line,s))
- # since it is a fatal logic error, bail out
- #assert(1==0)
- if done: continue
- D[s].append(ss1) # warning not yet encountered at this place exactly
- # now hashes have been merged
- D1={}
- continue # this input line is not further processed
- # deprecation warning from the compiler
- dep=match(deprecatedPattern,l)
- if dep:
- f=dep.group(1)
- line=int(dep.group(2))
- symbol=dep.group(3)
- if 'yade/lib-miniWm3/' in f: continue # ignore warnings in wwm3 headers themselves
- # this indicates inconsistency of what symbols are marked as deprecated and what we think these are
- if not symbol in renamedSymbols.keys():
- #logging.error("%s:%d: Unknown symbol `%s' reported as deprecated."%(f,line,symbol))
- unknownDeprec.add(symbol)
- continue
- Dcount+=1
- # handle cases where compiler reports wrong line number: adjust the line number
- if (symbol,f,line) in Doffsets.keys(): line=Doffsets[(symbol,f,line)]
- if not symbol in D1.keys(): # first warning emitted for this symbol in this file
- D1[symbol]=[[f,line,1]]
- continue
- done=False
- # iterate over all warnings about this symbols we've had so far in this run
- for ww in D1[symbol]:
- if ww[0]!=f: continue
- if ww[1]!=line: continue
- # only care if both filename and linenumber match: increment count
- ww[2]+=1
- done=True
- # otherwise create a new record
- if not done: D1[symbol].append([f,line,1])
-
-logging.info('Total number of %d deprecation warnings processed.'%Dcount)
-logging.info('These symbols were reported deprecated but are not known: %s'%(', '.join(unknownDeprec)))
-
-#############################################################################################################################
-## now go ahead and modify sources... :-( scared? huh, there will be many safety checks on the way, don't worry...
-##
-
-buildRoot=sys.argv[1]
-# reoarganize D, so that it is hashed by (file,line) and contains (symbol,count)
-F={}
-Fcount=0
-for symbol in D.keys():
- for ss in D[symbol]:
- file,line,count=ss
- if not F.has_key((file,line)):
- F[file,line]=[(symbol,count)]
- Fcount+=count
- else:
- for sss in F[file,line]: # can't have the same symbol twice...
- assert(sss!=(symbol,count))
- F[file,line].append((symbol,count))
- Fcount+=count
-
-logging.info('Merged into the total of %d usages of deprecated functions'%Fcount)
-
-# files that we will have to modify
-fileList=[]
-for f,l in F.keys():
- if not f in fileList: fileList.append(f)
-logging.info('%d files to be modified'%len(fileList))
-
-for fName in fileList:
- origFile=join(buildRoot,fName)
- origFile=os.path.realpath(origFile)
- bcupFile=origFile+'.~undeprecated~'
- logging.info("Modifying file `%s' (%s); backup is `%s'."%(origFile,fName,bcupFile))
- # the first branch is normal run. The second one is a dry-run, where original files are not modified
- if 0:
- shutil.move(origFile,bcupFile)
- fout=open(origFile,'w')
- fin=open(bcupFile)
- else:
- fin=open(origFile)
- fout=open(bcupFile,'w')
- lineno=0
- for l in fin.xreadlines():
- lineno+=1
- if F.has_key((fName,lineno)):
- for symbol,count in F[fName,lineno]: # this has list of symbols and their counts on this particular line
- l2,subs=subn(r'\b'+symbol+r'\b',renamedSymbols[symbol],l) # try textual replace
- # make sure we have found exactly the same number of matches compiler told us about!
- # this is not the case if the expressions spans several lines or if there are local symbols with the same name as the deprecated method
- # some cases have been already handled by the Doffset custom dictionary above
- #if subs!=count:
- # logging.info("%s:%d: Regexp found different number (%d) of `%s' than the compiler (%d).") # Fix by hand (replace by `%s'), please."%(fName,lineno,subs,symbol,count,renamedSymbols[symbol]))
- #l=l2
- #else:
- logging.info('%s:%d: %s -> %s %s'%(fName,lineno,symbol,renamedSymbols[symbol],'count mismatch %d!=%d'%(subs,count) if subs!=count else ''))
- l=l2
- fout.write(l)
-
-
-
-
-
-
-
-
-
=== removed file 'scripts/hackett.py'
--- scripts/hackett.py 2013-10-16 15:24:49 +0000
+++ scripts/hackett.py 1970-01-01 00:00:00 +0000
@@ -1,243 +0,0 @@
-#!/usr/bin/env python
-
-#
-# Hacket is a character from Beckett's Watt. It is only briefly intorduced once at the beginning of Watt,
-# (IIRC) shortly before Watt hears choir singing about big fat bun for everyone.
-#
-
-#
-# This script was used (once) to convert deprecated (bastardized) version of wm3 in yade to the official version
-# Arguments to provide are explained below.
-# Many things are hardcoded, don't ever try to use it without reading the source throughly.
-# You have been warned.
-#
-
-#
-# since the tags files must contain prototypes: I ran
-# ctags-exuberant --extra=+q --c++-kinds=+pf --language-force=c++ *
-# in wm3's Foundation/Math directory as well as in yade-lib-wm3-math
-#
-# To perform the actual conversion, I did
-# ./hackett.py tags-ok tags-bastard ~/yade/trunk/yade-libs/yade-lib-wm3-math/src/yade-lib-wm3-math
-# where tags-ok and tags-bastard are symlinked from their respective directories
-#
-
-
-import sys,os
-from re import *
-import string
-import logging
-from pprint import *
-import copy
-
-renamedTags={}
-# renames that are not obvious to be guess by the first-letter-case-changing algorithm
-# (they must include class name)
-renamedTags[('Math::cosinus')]=('Math::Cos')
-renamedTags[('Math::tangent')]=('Math::Tan')
-renamedTags[('Math::sinus')]=('Math::Sin')
-renamedTags[('Math::sqRoot')]=('Math::Sqrt')
-renamedTags[('Math::power')]=('Math::Pow')
-renamedTags[('Math::roundDown')]=('Math::Floor')
-renamedTags[('Math::roundUp')]=('Math::Ceil')
-renamedTags[('Math::invSqRoot')]=('Math::InvSqrt')
-renamedTags[('Math::eExp')]=('Math::Exp')
-renamedTags[('Math::logarithm')]=('Math::Log')
-
-logging.basicConfig(level=logging.DEBUG)
-
-def tagsParse(tagsFile):
- logging.info("Parsing tags file `%s'."%tagsFile)
- tags={}
- tagsFile=open(tagsFile)
- for l in tagsFile:
- l=l[:-1]
- # ctags header
- if l[0]=='!': continue
-
- if match('^\S*operator\s.*$',l): continue # discard operators
- if match('^.*\s[dntc]$',l): continue # discard #defines, namespaces, typedefs and classes
- #since the text field can contain \t which is otherwise field separator, pattern is clumsy but should work
- m=match('^(\S+|\S+operator \S+)\s+(\S+)\s+(/\^.*\$/;")\s+(\S+)\s+(\S+)?.*$',l)
- if not m:
- logging.warn("Line `%s' not matched"%l)
- continue
- name,file,text,type,extra=m.groups()[0:5]
- #print name,file,text,type,extra
-
- ### this is probably not needed anymore
- # these are typedefs, like this:
- # Wm3::Matrix2d Wm3Matrix2.h /^typedef Matrix2<double> Matrix2d;$/;" t namespace:Wm3
- # we don't need these, since they weren't bastardized
- if extra[0:10]=='namespace:': continue
- # some two bizzare cases (namespace opening and something different...)
- if extra[0:5]=='file:': continue
- #if extra[0:6]!='class:':
- # logging.warning('Skipping weird tag: %s, %s, %s, %s, %s',name,file,text,type,extra)
- # continue
-
- ## we want only prototypes and function definitions
- # perhaps they wouldn't pass through the regexp filter above anyway
- if not type in 'pf': continue
- # this would discard classes (have no '::'), but that should have been caught by the above as well...
- if name.find('::')<0: continue
- # end
-
- # prepend class name to the symbol name, unless it is already contained
- if extra[0:6]=='class':
- clss=extra[6:]
- if name.find(clss)!=0:
- name=clss+'::'+name
- if name[0:5]=='Wm3::': name=name[5:] # chop Wm3:: off the symbol name
-
- # ctags escape some metacharacters, we don't nee that
- text=text.replace('\\','')
-
- isAlready=False
- if tags.has_key(name):
- for t in tags[name]:
- if t[0]==type and t[1]==text and t[2]==file:
- # exact match found, skip
- isAlready=True
- if isAlready: continue
-
- if not tags.has_key(name): tags[name]=[]
- tags[name].append([type,text,file,False])
- return tags
-
-
-good=tagsParse(sys.argv[1])
-bad=tagsParse(sys.argv[2])
-badDir=sys.argv[3]
-
-#pprint(bad); pprint(good)
-#for c,n in good.keys(): print c
-#for c,n in bad.keys(): print c
-
-#tags that are in bad but not in good
-addedTags={}
-# tags that are only renamed in bad and otherwise exist in good
-# keys are (badClss,badName), values are keys in good: (goodClss,goodName)
-# list of (class,name) tags, that have been kept intact
-keptTags=[]
-
-
-for badTag in bad.keys():
- # probably not needed
- if match('::operator.*',badTag): continue
- bb=bad[badTag]
- # if the method is lowercase and uppercased appears in the good set, it was renamed
- cls,meth=badTag.split('::')
- goodTag=cls+'::'+meth[0].upper()+meth[1:]
- if renamedTags.has_key(badTag): continue
- elif good.has_key(badTag): keptTags.append(badTag)
- elif meth[0].lower()==meth[0] and good.has_key(goodTag):
- renamedTags[badTag]=goodTag
- # otherwise, it is an added method that has no corresponding good class
- else:
- addedTags[badTag]=bb[0]
-
-######################################################################
-### uncomment this to get symbols map for hackett-warn-replace.py
-
-if 0:
- r={}
- for t in renamedTags.keys(): r[t.split('::')[-1]]=renamedTags[t].split('::')[-1]
- for t in sorted(r.keys()): print "\t'%s':'%s',"%(t,r[t])
- sys.exit(0)
-
-# now accumulate changes for particular files, so that we can iterate over files conveniently
-fileReplace=[]
-for t in renamedTags:
- for bb in bad[t]:
- f=bb[2]
- if not f in fileReplace: fileReplace.append(f)
-#pprint(fileReplace)
-#pprint(renamedTags)
-
-
-##############################################
-######## here begins the actual work
-##############################################
-
-import shutil
-from os.path import join
-
-for fName in fileReplace:
- origFile=join(badDir,fName)
- bcupFile=origFile+'.~bastardized.0~'
- logging.info("Processing `%s'."%origFile)
- if 1: # if 1, files will be copied and written over; the next branch writes to "backup" files
- shutil.move(origFile,bcupFile)
- fout=open(origFile,'w')
- fin=open(bcupFile)
- else:
- fin=open(origFile)
- fout=open(bcupFile,'w')
- # buffer for line that has not been syntactically terminated
- leftOver=''
- written=False
- for l in fin.xreadlines():
- if len(leftOver)>0: l=leftOver+l
- written=False
- for tt in renamedTags:
- for t in bad[tt]:
- #if t[0]!='p': continue # for now, only do prototypes...
- #print t
- pat=t[1][2:-4] # line hardcopy - discard leading /^ and trailing $;/"
- f=t[2] # filename
- if f!=fName: continue
- if not l.find(pat)<0:
- if t[3]: # there are two different tags in the same file, but their text signature is the same - presumaly argument list that differs continues on the next line etc. Since it will cause erroneous output, shout to the user
- logging.info("The method `%s' had the same tag `%s' twice (overloaded?). Please fix by hand!!!"%(tt,pat))
- continue
- # classes may be discarded from names
- badMethName=tt.split('::')[-1]
- goodMethName=renamedTags[tt].split('::')[-1]
- # badMethName is the old method inline declarationand definition that is marked as deprecated and merely wraps the new method
- # goodMethName is the new method
- # badMeth and goodMeth are corresponding source lines that we will create
-
- # this pattern matches both declaration and definition header. It must return return type in \1, method argument list in \2.
- methodPattern=r'^(.*?)\b'+badMethName+r'\b\s?(\s?\(.*\)\s*(const)?)\s*(;|{).*$';
- badMeth,count=subn(methodPattern,r'\1'+badMethName+r'\2',l)
- goodMeth,count2=subn(methodPattern,r'\1'+goodMethName+r'\2 \4',l)
- # match the same times for both methods (always, since pattern is the same)
- # match at most once; otherwise output might be syntactically incorrect
- assert(count==count2); assert(count<=1)
- # we will append function body (wrapper) to badMeth, get rid of newline
- badMeth=badMeth.replace('\n',''); #goodMeth=goodMeth.replace('\n','')
- badMeth="\t__attribute__((deprecated)) inline "+badMeth
-
- if count==0: leftOver=l[:-1] # the declaration is not terminated at this lines, process with the next line
- elif count==1:
- leftOver=''
- t[3]=True # this particular tag has been processed by us - this allows us to list unprocessed tags at the end, if there are any, since taht would probably indicate some error
- if t[0]=='p': # we are dealing with prototype, hence we define wrapper for goodMeth
- args=search(r'\((.*)\)',goodMeth); # extract arguments
- assert(args)
- a=args.group(1);
- args=args.group(1).split(',') # process args one by one
- try: args.remove('') # in case of void methods, remove empty args
- except ValueError: pass
-
- # begin building the wrapper
- badMeth+='{return '+goodMethName+'('
- # pass it all arguments
- for i in range(0,len(args)):
- var=args[i].split()[-1] # for every arg, only the last word (variable name), not type
- var=sub('\[[0-9]+\]$','',var) # remove array brackets after variable
- badMeth+=var
- if i<len(args)-1: badMeth+=',' # append , except after the last arg
- badMeth+=');}\n'
- fout.write(badMeth) # wrapper is on the line preceeding the actual method
- fout.write(goodMeth) # write goodMeth
- written=True
- if not written and leftOver=='': fout.write(l) # write lines that were not interesting
-
-
-# list tags that have not been processed. There shouldn't be any.
-for tt in renamedTags:
- for t in bad[tt]:
- if t[3]==False: logging.warning("Tag `%s' was not processed (%s)!"%(tt,t))
-
=== removed file 'scripts/installOnUbuntu.sh'
--- scripts/installOnUbuntu.sh 2009-08-24 15:35:49 +0000
+++ scripts/installOnUbuntu.sh 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-#!/bin/bash
-# This script works on Ubuntu 9.04, and possibly on new Debians.
-# It "compiles and installs" the latest YADE BZR-version.
-# The install is maximal: you will get almost all YADE functionality, even if you dont need it
-# Please, copy this script to the empty directory and start it.
-#
-# WARNING: this will install on your machine the version, that may not work for you
-# for a while. It can happen because of some "working" commits to the repository.
-# If it happens, wait a little bit and try again. Or contact us through mailing list.
-#
-
-
-BASEDIR='.'
-VERSION='trunk'
-sudo aptitude install scons libqt3-mt-dev qt3-dev-tools freeglut3-dev libboost-date-time-dev libboost-filesystem-dev libboost-thread-dev libboost-regex-dev fakeroot dpkg-dev build-essential g++ libboost-iostreams-dev liblog4cxx10-dev python-dev libboost-python-dev ipython python-matplotlib libsqlite3-dev python-numeric python-tk gnuplot doxygen python-pygraphviz python-epydoc libgts-dev
-bzr checkout lp:yade
-mkdir $BASEDIR/build
-mkdir $BASEDIR/build/data
-cd $BASEDIR/yade
-scons PREFIX=$BASEDIR/../build optimize=1 -j2 features=log4cxx,python,opengl,gts,openmp version=$VERSION linkStrategy=monolithic
-scons doc
-cd doc
-$BASEDIR/../../build/bin/yade-$VERSION yade-epydoc.py
-
=== removed file 'scripts/make-release.sh'
--- scripts/make-release.sh 2008-07-25 10:02:04 +0000
+++ scripts/make-release.sh 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-# this script must be run from the top-level source directory (the one with SConstruct)
-RELEASE=$1
-if [ -z "$RELEASE" ]; then echo "Pass the version number as first argument"; exit 1; fi
-if [ ! -e "SConstruct" ]; then echo "Run this script from the top-level source directory (sh scripts/make-release.sh $RELEASE)"; exit 1; fi
-echo $1 > RELEASE
-MYPWD=`/bin/pwd`
-MYSUBDIR=${MYPWD##*/}
-MYPARENT=${MYPWD%/*}
-#echo $MYPWD $MYPARENT $MYSUBDIR
-cd $MYPARENT; mv $MYSUBDIR yade-$RELEASE; tar c yade-$RELEASE | bzip2 > yade-$RELEASE.tar.bz2; mv yade-$RELEASE $MYSUBDIR; cd $MYSUBDIR
-rm RELEASE
-ls -l ../yade-$RELEASE.tar.bz2
-echo "All done, bye."
=== removed file 'scripts/regression-tests.py'
--- scripts/regression-tests.py 2009-11-23 12:32:14 +0000
+++ scripts/regression-tests.py 1970-01-01 00:00:00 +0000
@@ -1,20 +0,0 @@
-"""
-Run all defined regression tests, then exit.
-Exit status is 0 on success and nonzero on failure.
-"""
-import yade.tests
-try:
- result=yade.tests.testAll()
-except:
- print "*********************** UNEXPECTED EXCEPTION WHILE RUNNING TESTS ******************"
- print "******************",sys.exc_info()[0]
- print "****************** Please report bug at http://bugs.launchpad.net/yade providing the following traceback:"
- import traceback
- traceback.print_exc()
- print "***************************************** Thank you *******************************"
- sys.exit(2)
-if result.wasSuccessful():
- print "*** ALL TESTS PASSED ***"
-else:
- print "********************** SOME TESTS FAILED ************************"
-sys.exit(0 if result.wasSuccessful() else 1)
=== removed file 'scripts/scanreplace.py'
--- scripts/scanreplace.py 2009-12-05 10:45:14 +0000
+++ scripts/scanreplace.py 1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
-# source: http://www.scons.org/wiki/ReplacementBuilder
-# used internally by scons, do not delete
-
-from string import Template
-
-def replace_action(target, source, env):
- open(str(target[0]),'w').write(Template(open(str(source[0]),'r').read()).safe_substitute(env))
- return 0
-
-def replace_string(target, source, env):
- return None #"T %s %s" % (str(source[0]), str(target[0]))
-
-def generate(env, **kw):
- action = env.Action(replace_action, replace_string)
- env['BUILDERS']['ScanReplace'] = env.Builder(action=action, src_suffix='.in', single_source=True)
-
-def exists(env):
- return 1
-
=== removed file 'scripts/yade-exec-wrapper'
--- scripts/yade-exec-wrapper 2010-01-09 17:26:41 +0000
+++ scripts/yade-exec-wrapper 1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
-#!/usr/bin/python
-"""Get yade binary as the first argument. Run it, passing all other arguments.
-If yade succeeds or crashes at exit, return success, otherwise return the same error as yade.
-
-Purpose: run binary even if no installed in the PREFIX (using YADE_PREFIX),
-and return no error if there is only (expected) crash at exit.
-
-You should only run non-interactive sessions this way.
-"""
-import os,sys,subprocess
-from os.path import *
-bin=abspath(sys.argv[1])
-print bin,dirname(bin)
-prefix=normpath(dirname(bin)+'/..')
-cmd='DISPLAY= LD_PRELOAD= YADE_PREFIX='+prefix+' '+' '.join(sys.argv[1:])
-print cmd
-p=subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,shell=True)
-pout=p.communicate()[0]
-retval=p.wait()
-print pout
-if retval==0 or 'Yade: normal exit.' in pout: sys.exit(0)
-sys.exit(retval)
=== removed file 'scripts/ysl1.py'
--- scripts/ysl1.py 2007-03-31 06:18:17 +0000
+++ scripts/ysl1.py 1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-
-# 1. Move all files (.*)/([^/]*)/src/\2/(.*)$ -> \1/\3 using svn
-# 2. Rename all directories named yade-([a-z]+)-([a-z]+) -> \2 using svn
-
-action=['*/src/*','*/src','yade-*-*','pkg-*/*/*/*'][3]
-import re,os
-#import pysvn
-#client = pysvn.Client()
-
-dd=open('/tmp/d','w')
-emptyDirs=[]
-for root, dirs, files in os.walk('..'):
- for d in ('.svn','yade-flat','include'):
- try: dirs.remove(d)
- except ValueError: pass
- for d in dirs: emptyDirs.append(d)
- for f in files+dirs:
- rootf=root+'/'+f
- if action=='*/src/*':
- m=re.match(r'(.*)/([^/]*)/src/\2/(.*)$',rootf)
- if m:
- newFile=m.group(1)+'/'+m.group(2)+'/'+m.group(3)
- #client.move(rootf,newFile)
- os.system('svn move %s %s'%(rootf,newFile))
- dd.write(root+'\n')
- elif action=='*/src':
- m=re.match(r'(.*)/([^/]*)/src/([^/]*)$',rootf)
- if m:
- newFile=m.group(1)+'/'+m.group(2)+'/'+m.group(3)
- #client.move(rootf.newFile)
- os.system('svn move %s %s'%(rootf,newFile))
- #print rootf,newFile
- elif action=='yade-*-*':
- m=re.match(r'(.*)/yade-([a-z]+)-([a-z-]+)$',rootf)
- if m:
- newDir=m.group(1)+'/'+m.group(3)
- if m.group(3)=='dem-simulator': newDir=m.group(1)+'/spherical-dem-simulator'
- os.system('svn move %s %s'%(rootf,newDir))
- #print rootf,newDir
- elif action=='pkg-*/*/*/*':
- # target structure:
- # {DataClass,Engine}/*/*.?pp
- # {RenderingEngine,PreProcessor,Container}/*.?pp
- if os.path.isdir(rootf): continue # skip dirs here
- m=re.match(r'(.*)/pkg/([^/]+)/(Engine|DataClass|RenderingEngine|PreProcessor|Container)/([^/]*)/([^/]*/)?(.+\..pp)$',rootf)
- #deep1=re.match(r'(.*)/pkg/([^/]+)/(PreProcessor|Container)/([^/]*)/([^/]*)/?(.*)$',rootf)
- cmd=None
- if m:
- gg=m.groups()
- ## gg[4] will be skipped
- # replace any references to it in SConscript files
- script="%s/pkg/%s/SConscript"%(gg[0],gg[1])
- if gg[2] in ['Engine','DataClass','RenderingEngine']:
- skipped=''
- if gg[4]: skipped+="/%s"%gg[4][:-1] ## gg[4] has trailing /
- if len(skipped)==0: continue
- cmd=["perl -pi~ -e's@(%s/%s)%s([^.])@\\1\\2@' %s"%(gg[2],gg[3],skipped,script)]
- newFile="%s/pkg/%s/%s/%s/%s"%(gg[0],gg[1],gg[2],gg[3],gg[5])
- elif gg[2] in ['PreProcessor','Container']:
- skipped='/%s'%gg[3]
- if gg[4]: skipped+="/%s"%gg[4][:-1]
- cmd=["perl -pi~ -e's@(%s)%s([^.])@\\1\\2@' %s"%(gg[2],skipped,script)]
- newFile="%s/pkg/%s/%s/%s"%(gg[0],gg[1],gg[2],gg[5])
- else: raise RuntimeError
- cmd+=["svn move %s %s"%(rootf,newFile)]
- dd.write(root+'\n')
- #print cmd[0]
- #print cmd[1]
- for cc in cmd: os.system(cc)
- #os.system(cmd)
- # print cmd
-
-dd.close()
-
-
-