2 Ce module sert à construire les distributions d'EFICAS en fonction
4 Les distributions sont :
5 - un tar.gz pour UNIX ne contenant pas mxTextTools
6 - un zip pour Windows contenant mx TextTools préinstallé
7 L'utilisation de ce module est la suivante :
8 1- Se mettre dans un répertoire de travail
9 2- Configurer son environnement pour utiliser le référentiel CVS EFICAS
10 3- Exporter les sources d'EficasV1 par la commande :
11 cvs export -r TAG -d Eficas_export EficasV1
12 ou TAG est le tag CVS de la version que l'on veut distribuer (par exemple V1_1p1)
13 4- Copier le répertoire fourni par Aster (ACCAS6.2.0) au meme niveau que Eficas_export
14 5- Aller dans le répertoire Eficas_export
15 6- Executer le script sdist.py
17 Ce qui a pour effet de creer un repertoire dist contenant les 2 distributions
18 et de les copier dans le répertoire indiqué par dir_download s'il est accessible
21 import os,shutil,glob,sys
24 version="$Name: $"[7:-2] or 'Test1_4'
25 # ==========Path du noyau fourni par Aster====================
26 path_Noyau="../../AccasAster"
27 # ============================================================
28 nom_distrib="Eficas"+version+"AsterSTA7"
29 path_distrib=os.path.join("dist",nom_distrib)
30 path_TextTools="/home/eficas/pkg/mxTools/egenix2.0.2pourWindows/mx/TextTools"
31 dir_download= "/home/eficas/WWW/telechargement/eficas"
34 if os.path.isdir('dist'):shutil.rmtree('dist')
36 copyfiles('.',path_distrib,['LICENSE.TERMS','INSTALL','NEWS'])
38 copyfiles('../Editeur',os.path.join(path_distrib,'Editeur'),['*.py','faqs.txt'])
39 copyfiles('../Ihm',os.path.join(path_distrib,'Ihm'),['*.py'])
40 copyfiles('../Extensions',os.path.join(path_distrib,'Extensions'),['*.py'])
41 copyfiles('../Misc',os.path.join(path_distrib,'Misc'),['*.py'])
42 copyfiles('../Accas',os.path.join(path_distrib,'Accas'),['*.py'])
44 copyfiles('../AIDE',os.path.join(path_distrib,'AIDE'),['*.py'])
45 copyfiles('../AIDE/fichiers',os.path.join(path_distrib,'AIDE','fichiers'),['*'])
46 copyfiles('.',os.path.join(path_distrib,'AIDE','fichiers'),['INSTALL','NEWS'])
47 copyfiles('../Editeur',os.path.join(path_distrib,'AIDE','fichiers'),['faqs.txt'])
49 copyfiles('../Aster',os.path.join(path_distrib,'Aster'),['prefs.py',
54 copyfiles('../convert',os.path.join(path_distrib,'convert'),['*.py'])
55 copyfiles('../convert/Parserv5',os.path.join(path_distrib,'convert','Parserv5'),['*.py'])
57 copyfiles('../generator',os.path.join(path_distrib,'generator'),['*.py'])
59 copyfiles('../Editeur/icons',os.path.join(path_distrib,'Editeur','icons'),['*.gif'])
61 copyfiles(os.path.join(path_Noyau,'Noyau'),os.path.join(path_distrib,'Noyau'),['*.py'])
62 copyfiles(os.path.join(path_Noyau,'Validation'),os.path.join(path_distrib,'Validation'),['*.py'])
63 copyfiles(os.path.join(path_Noyau,'Cata'),os.path.join(path_distrib,'Aster','Cata'),['*.py',
65 copyfiles(os.path.join(path_Noyau,'Macro'),os.path.join(path_distrib,'Aster','Cata','Macro'),['*.py'])
67 copyfiles('../Tools',os.path.join(path_distrib,'Tools'),['*.py'])
68 copyfiles('../Tools/foztools',os.path.join(path_distrib,'Tools','foztools'),['*.py'])
70 tarball= maketarball('dist',nom_distrib,nom_distrib)
72 shutil.copy(tarball,dir_download)
74 print "Repertoire de download inconnu : ",dir_download
77 shutil.copytree(path_TextTools,os.path.join(path_distrib,'Tools','TextTools'))
79 print "Impossible de recuperer mxTextTools : ",dir_download
82 zipfile= makezipfile('dist',nom_distrib,nom_distrib)
84 shutil.copy(zipfile,dir_download)
86 print "Repertoire de download inconnu : ",dir_download
88 def make_dir(dir_cible):
89 if type(dir_cible) is not types.StringType:
90 raise "make_dir : dir_cible doit etre une string (%s)" % `dir_cible`
91 head,tail=os.path.split(dir_cible)
93 while head and tail and not os.path.isdir(head):
94 head,tail=os.path.split(head)
98 head = os.path.join(head, d)
99 if not os.path.isdir(head):os.mkdir(head)
102 def copyfiles(dir_origin,dir_cible,listfiles):
103 if not os.path.isdir(dir_cible):make_dir(dir_cible)
104 for glob_files in listfiles:
105 for file in glob.glob(os.path.join(dir_origin,glob_files)):
106 shutil.copy(file,dir_cible)
108 def maketarball(dir_trav,dir_cible,nom_tar):
112 os.system("tar -cf "+nom_tar+".tar "+dir_cible)
113 os.system("gzip -f9 "+nom_tar+".tar ")
115 return os.path.join(dir_trav,nom_tar+".tar.gz")
117 def makezipfile(dir_trav,dir_cible,nom_tar):
120 os.system("zip -rq "+nom_tar+".zip "+dir_cible)
122 return os.path.join(dir_trav,nom_tar+".zip")