source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/util/oasisgui/opentea/mapping.py @ 4775

Last change on this file since 4775 was 4775, checked in by aclsce, 5 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

File size: 69.0 KB
Line 
1#  This program is under CECILL_B licence. See footer for details.
2
3# the purpose of this program is to add headers and footers for Licensing sources.
4# Its far from generic
5
6
7import os
8import random
9import string
10import glob
11
12path=os.getcwd()
13nameraw=os.listdir(path)
14name = []
15for item in nameraw:
16    if os.path.isfile(item):
17        if not item.startswith('.'):
18            if not item.startswith('mapping'):
19                name.append(item) 
20           
21
22fileExtension=[{} for i in range(len(name))]
23fileName=[{} for i in range(len(name))]
24completeName=[{} for i in range(len(name))]
25
26# initialisation
27
28
29year ="2014"
30company= "CERFACS"
31headerdb={}
32headerdb["licences"]=[]
33
34content="""Copyright """+company+" "+year+"""
35 
36antoine.dauptain@cerfacs.fr
37 
38This software is a computer program whose purpose is to ensure technology
39transfer between academia and industry.
40 
41This software is governed by the CeCILL-B license under French law and
42abiding by the rules of distribution of free software.  You can  use,
43modify and/ or redistribute the software under the terms of the CeCILL-B
44license as circulated by CEA, CNRS and INRIA at the following URL
45"http://www.cecill.info".
46 
47As a counterpart to the access to the source code and  rights to copy,
48modify and redistribute granted by the license, users are provided only
49with a limited warranty  and the software's author,  the holder of the
50economic rights,  and the successive licensors  have only  limited
51liability.
52 
53In this respect, the user's attention is drawn to the risks associated
54with loading,  using,  modifying and/or developing or reproducing the
55software by the user in light of its specific status of free software,
56that may mean  that it is complicated to manipulate,  and  that  also
57therefore means  that it is reserved for developers  and  experienced
58professionals having in-depth computer knowledge. Users are therefore
59encouraged to load and test the software's suitability as regards their
60requirements in conditions enabling the security of their systems and/or
61data to be ensured and,  more generally, to use and operate it in the
62same conditions as regards security.
63 
64The fact that you are presently reading this means that you have had
65knowledge of the CeCILL-B license and that you accept its terms."""
66
67headerdb["licences"].append("cecill")
68headerdb["cecill","header"] = "This program is under CECILL_B licence. See footer for details."
69headerdb["cecill","footer"] = content.split("\n")
70headerdb["cecill","name"] = "Cecill-B"
71
72
73content="""Copyright """+company+" "+year+"""
74 
75antoine.dauptain@cerfacs.fr
76 
77This software is a computer program whose purpose is to ensure technology
78transfer between academia and industry.
79 
80This software is governed by a OpenScience license.
81You can  use,  modify and/ or redistribute the software.
82 
83As a counterpart to the access to the source code and  rights to copy,
84modify and redistribute granted by the license, users are provided only
85with a limited warranty  and the software's author,  the holder of the
86economic rights.
87 
88In this respect, the user's attention is drawn to the risks associated
89with loading,  using,  modifying and/or developing or reproducing the
90software by the user in light of its specific status of free software,
91that may mean  that it is complicated to manipulate,  and  that  also
92therefore means  that it is reserved for developers  and  experienced
93professionals having in-depth computer knowledge. Users are therefore
94encouraged to load and test the software's suitability as regards their
95requirements in conditions enabling the security of their systems and/or
96data to be ensured and,  more generally, to use and operate it in the
97same conditions as regards security.
98 
99The fact that you are presently reading this means that you have had
100knowledge of the OpenScience license and that you accept its terms"""
101
102headerdb["licences"].append("openscience")
103headerdb["openscience","header"] = "This program is under OpenScience licence. See footer for details"
104headerdb["openscience","footer"] = content.split("\n")
105headerdb["openscience","name"] = "openscience"
106
107
108content="Copyright CERFACS-IFP-SAFRAN "+year+"""
109 
110antoine.dauptain@cerfacs.fr
111 
112Ce logiciel est un programe informatique dont l'objectif est de proposer
113des outils numeriques pour l'etude de la combustion, des turbomachines,
114de l'acoustique, de la thermique et du rayonmment.
115 
116Ce logiciel est gouverne par l'ACCORD DE COOPERATION AVBP (N. IFP 31.293)
117sous loi francaise, et fait explicitement partie de la -version commune- d'AVBP.
118 
119Ce logiciel est la copropriete de CERFACS, SAFRAN et l'IFPEN, nommees ci apres les Parties,
120dans les termes de l'ACCORD DE COOPERATION AVBP.
121En cela:
122-  Chaque Partie pourra utiliser la -version commune- du code AVBP
123incluant la modalite 1 et la modalite 2 pour ses besoins propres
124de recherche librement, gratuitement, et sans limitation de duree.
125Par besoins propres de recherche, on entend une utilisation en
126interne de la -version commune- du code AVBP par une Partie pour
127des activites commerciales.
128 
129-le CERFACS et l'IFPEN pourront librement entreprendre l'exploitation
130commerciale de la -version commune- du code AVBP incluant la modalite 1
131et la modalite 2 en toute independance et gratuitement a l'egard de
132l'autre partie, sous reserve de ne pas l'utiliser au profit de concurrents
133de SAFRAN ni de la diffuser a des tiers sous quelque forme que ce soit.
134 
135-SAFRAN pourra exploiter librement la -version commune- du code AVBP
136incluant la modalite 1 dans le cadre de son activite d'etude et de
137conception de ses produits, sous reserve de ne pas l'utiliser au profit
138de concurrents du CERFACS et le l'IFP, ni de la diffuser a des tiers
139sous quelque forme que ce soit.
140 
141L'utilisation de la -version commune- du code AVBP sera aux seuls
142risques de la partie exploitante et sous la seule responsabilite de
143la dite Partie. La -version commune- et toute documentation eventuelle
144y afferente sont fournis en l'etat, sans garantie d'aucune sorte.
145Nottament, aucune garantie en ce qui concerne l'utilisation initerrompue
146du code, ou les resultats obtenus lors de l'utilisation de la
147-version commune-, que ce soit leur exactitude, fiabilite ou autre,
148ou la jouissance paisible de la -version commune- n'est donnee.
149En consequence chacune des parties renonce a tout recours vis a vis des
150autres parties en ce qui concerne les consequences resultant de
151l'utilisation de la -version commune-, de quelque nature que ce soit.
152 
153A cet egard  l'attention de l'utilisateur est attiree sur les risques
154associes au chargement,  a l'utilisation,  a la modification et/ou au
155developpement et a la reproduction du logiciel par l'utilisateur etant
156donne sa specificite de logiciel scientifique, qui peut le rendre complexe a
157manipuler et qui le reserve donc a des developpeurs et des professionnels
158avertis possedant  des  connaissances  informatiques approfondies. Les
159utilisateurs sont donc invites a charger et tester l'adequation  du
160logiciel a leurs besoins dans des conditions permettant d'assurer la
161securite de leurs systemes et ou de leurs donnees et, plus generalement,
162a l'utiliser et l'exploiter dans les memes conditions de securite.
163 
164Le fait que vous puissiez acceder a cet en-tete signifie que vous avez
165pris connaissance de l'ACCORD DE COOPERATION AVBP, et que vous en avez
166accepte les termes."""
167
168headerdb["licences"].append("accordAVBP")
169headerdb["accordAVBP","header"] = "Ce programme depend des accords l'ACCORD DE COOPERATION AVBP (N. IFP 31.293). Voir la fin du programme pour plus de details."
170headerdb["accordAVBP","footer"] = content.split("\n")
171headerdb["accordAVBP","name"] = "accordAVBP"
172
173mapping=""
174
175ii=0
176_python=0
177_fortran=0
178_tcl=0
179_html=0
180_XML=0
181_others=0
182_files=0
183_cecill=0
184_cerfacs=0
185_openscience=0
186
187if os.path.isfile('mapping.txt'):
188    fichier=open('mapping.txt',"r")
189    mapp=fichier.read().split("\n")
190    fichier.close()
191    for i in range(len(name)):
192        (fileName[i], fileExtension[i]) = os.path.splitext(name[i])
193        completeName[i]=path + '/' + fileName[i]
194    for i in range(len(name)):
195        fichier=open(fileName[i]+fileExtension[i],"r")
196        contenu=fichier.read().split("\n")
197        fichier.close()
198        contenu3=""
199        _files=_files+1
200       
201# Boucle global
202       
203        if completeName[i] in mapp[ii]:
204
205            ##### Compte Lincences #####
206           
207            if 'CERFACS' in mapp[ii]:
208                _cerfacs=_cerfacs+1
209            elif 'CECILL' in mapp[ii]:
210                _cecill=_cecill+1
211            elif 'OPENSCIENCE' in mapp [i]:
212                _openscience=_openscience+1
213           
214# Extension python
215           
216            if fileExtension[i]=='.py':
217               
218                _python=_python+1
219               
220                mapping += completeName[i]+" "*(95-len(completeName[i]))+fileExtension[i]+" "*(15-len(fileExtension[i]))
221               
222                ##### CERFACS #####
223               
224                if 'CERFACS' in mapp[ii]:
225                   
226                    ###### Header #####
227                   
228                    if contenu[0].startswith("#  This program"):
229                        contenu[0]="#  "+headerdb["accordAVBP","header"]
230                    elif contenu[0].startswith("#  Ce programme"):
231                        contenu[0]="#  "+headerdb["accordAVBP","header"]
232                    else:
233                        contenu[0]="#  "+headerdb["accordAVBP","header"]+"\n\n"+contenu[0]
234                       
235                    ##### Footer #####
236                   
237                    if contenu[len(contenu)-1].startswith("#  accepte"):
238                        num=0
239                        for line in headerdb["accordAVBP","footer"]:
240                            contenu.remove("#  "+headerdb["accordAVBP","footer"][num])
241                            num=num+1
242                        num=0
243                        for line in headerdb["accordAVBP","footer"]:
244                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["accordAVBP","footer"][num]
245                            num=num+1
246                           
247                           
248                    elif contenu[len(contenu)-1].startswith("#  knowledge of the CeCILL-B"):
249                        num=0
250                        for line in headerdb["cecill","footer"]:
251                            contenu.remove("#  "+headerdb["cecill","footer"][num])
252                            num=num+1
253                        num=0
254                        for line in headerdb["accordAVBP","footer"]:
255                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["accordAVBP","footer"][num]
256                            num=num+1
257                           
258                           
259                    elif contenu[len(contenu)-1].startswith("#  knowledge of the OpenScience"):
260                        num=0
261                        for line in headerdb["openscience","footer"]:
262                            contenu.remove("#  "+headerdb["openscience","footer"][num])
263                            num=num+1
264                        num=0
265                        for line in headerdb["accordAVBP","footer"]:
266                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["accordAVBP","footer"][num]
267                            num=num+1
268                           
269                           
270                    else:
271                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
272                        num=0
273                        for line in headerdb["accordAVBP","footer"]:
274                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["accordAVBP","footer"][num]
275                            num=num+1
276                       
277                    mapping += ' / CERFACS'
278                   
279                   
280                ##### CECILL #####
281                           
282                elif 'CECILL' in mapp[ii]:
283                   
284                    ##### Header #####
285                   
286                    if contenu[0].startswith("#  This program"):
287                        contenu[0]="#  "+headerdb["cecill","header"]
288                    elif contenu[0].startswith("#  Ce programme"):
289                        contenu[0]="#  "+headerdb["cecill","header"]
290                    else:
291                        contenu[0]="#  "+headerdb["cecill","header"]+"\n\n"+contenu[0]
292                       
293                    ##### Footer #####
294                   
295                    if contenu[len(contenu)-1].startswith("#  accepte"):
296                        num=0
297                        for line in headerdb["accordAVBP","footer"]:
298                            contenu.remove("#  "+headerdb["accordAVBP","footer"][num])
299                            num=num+1
300                        num=0
301                        for line in headerdb["cecill","footer"]:
302                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["cecill","footer"][num]
303                            num=num+1
304                           
305                           
306                    elif contenu[len(contenu)-1].startswith("#  knowledge of the CeCILL-B"):
307                        num=0
308                        for line in headerdb["cecill","footer"]:
309                            contenu.remove("#  "+headerdb["cecill","footer"][num])
310                            num=num+1
311                        num=0
312                        for line in headerdb["cecill","footer"]:
313                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["cecill","footer"][num]
314                            num=num+1
315                           
316                           
317                    elif contenu[len(contenu)-1].startswith("#  knowledge of the OpenScience"):
318                        num=0
319                        for line in headerdb["openscience","footer"]:
320                            contenu.remove("#  "+headerdb["openscience","footer"][num])
321                            num=num+1
322                        num=0
323                        for line in headerdb["cecill","footer"]:
324                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["cecill","footer"][num]
325                            num=num+1
326                           
327                           
328                    else:
329                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
330                        num=0
331                        for line in headerdb["cecill","footer"]:
332                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["cecill","footer"][num]
333                            num=num+1
334                       
335                    mapping += ' / CECILL'
336                   
337                   
338                ##### OPENSCIENCE #####
339               
340                elif 'OPENSCIENCE' in mapp[ii]:
341                   
342                    ##### Header #####
343                   
344                    if contenu[0].startswith("#  This program"):
345                        contenu[0]="#  "+headerdb["openscience","header"]
346                    elif contenu[0].startswith("#  Ce programme"):
347                        contenu[0]="#  "+headerdb["openscience","header"]
348                    else:
349                        contenu[0]="#  "+headerdb["openscience","header"]+"\n\n"+contenu[0]
350                       
351                    ##### Footer #####
352                   
353                    if contenu[len(contenu)-1].startswith("#  accepte"):
354                        num=0
355                        for line in headerdb["accordAVBP","footer"]:
356                            contenu.remove("#  "+headerdb["accordAVBP","footer"][num])
357                            num=num+1
358                        num=0
359                        for line in headerdb["openscience","footer"]:
360                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["openscience","footer"][num]
361                            num=num+1
362                           
363                           
364                    elif contenu[len(contenu)-1].startswith("#  knowledge of the CeCILL-B"):
365                        num=0
366                        for line in headerdb["cecill","footer"]:
367                            contenu.remove("#  "+headerdb["cecill","footer"][num])
368                            num=num+1
369                        num=0
370                        for line in headerdb["openscience","footer"]:
371                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["openscience","footer"][num]
372                            num=num+1
373                           
374                           
375                    elif contenu[len(contenu)-1].startswith("#  knowledge of the OpenScience"):
376                        num=0
377                        for line in headerdb["openscience","footer"]:
378                            contenu.remove("#  "+headerdb["openscience","footer"][num])
379                            num=num+1
380                        num=0
381                        for line in headerdb["openscience","footer"]:
382                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["openscience","footer"][num]
383                            num=num+1
384                           
385                           
386                    else:
387                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
388                        num=0
389                        for line in headerdb["openscience","footer"]:
390                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["openscience","footer"][num]
391                            num=num+1
392                       
393                    mapping += ' / OPENSCIENCE'
394                 
395                 
396                ##### Pas de licence #####
397               
398                elif 'NONE' in mapp[ii]:
399                   
400                    ##### Header #####
401                   
402                    if contenu[0].startswith("#  This program is under CECILL_B"):
403                        contenu.remove("#  "+headerdb["cecill","header"])
404                    elif contenu[0].startswith("#  This program is under OpenScience"):
405                        contenu.remove("#  "+headerdb["openscience","header"])
406                    elif contenu[0].startswith("#  Ce programme"):
407                        contenu.remove("#  "+headerdb["accordAVBP","header"])
408                       
409                    ##### Footer #####
410                   
411                    if contenu[len(contenu)-1].startswith("#  accepte"):
412                        num=0
413                        for line in headerdb["accordAVBP","footer"]:
414                            contenu.remove("#  "+headerdb["accordAVBP","footer"][num])
415                            num=num+1
416                           
417                    elif contenu[len(contenu)-1].startswith("#  knowledge of the CeCILL-B"):
418                        num=0
419                        for line in headerdb["cecill","footer"]:
420                            contenu.remove("#  "+headerdb["cecill","footer"][num])
421                            num=num+1
422                           
423                    elif contenu[len(contenu)-1].startswith("#  knowledge of the OpenScience"):
424                        num=0
425                        for line in headerdb["openscience","footer"]:
426                            contenu.remove("#  "+headerdb["openscience","footer"][num])
427                            num=num+1
428                           
429                    mapping += ' / NONE'
430                   
431                else:
432                    mapping += ' / PRE NONE'
433                   
434                ##### Ecriture #####
435               
436                mapping += '\n'
437                   
438                for k in range(len(contenu)):
439                    contenu[k]=contenu[k]+'\n'
440                    contenu3+=contenu[k]
441                   
442# Extension Fortran
443                       
444            elif fileExtension[i]=='.f90':
445               
446                _fortran=_fortran+1
447               
448                mapping += completeName[i]+" "*(95-len(completeName[i]))+fileExtension[i]+" "*(15-len(fileExtension[i]))
449               
450                ##### CERFACS #####
451               
452                if 'CERFACS' in mapp[ii]:
453                   
454                    ###### Header #####
455                   
456                    if contenu[0].startswith("!  This program"):
457                        contenu[0]="!  "+headerdb["accordAVBP","header"]
458                    elif contenu[0].startswith("!  Ce programme"):
459                        contenu[0]="!  "+headerdb["accordAVBP","header"]
460                    else:
461                        contenu[0]="!  "+headerdb["accordAVBP","header"]+"\n\n"+contenu[0]
462                       
463                    ##### Footer #####
464                   
465                    if contenu[len(contenu)-1].startswith("!  accepte"):
466                        num=0
467                        for line in headerdb["accordAVBP","footer"]:
468                            contenu.remove("!  "+headerdb["accordAVBP","footer"][num])
469                            num=num+1
470                        num=0
471                        for line in headerdb["accordAVBP","footer"]:
472                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["accordAVBP","footer"][num]
473                            num=num+1
474                           
475                           
476                    elif contenu[len(contenu)-1].startswith("!  knowledge of the CeCILL-B"):
477                        num=0
478                        for line in headerdb["cecill","footer"]:
479                            contenu.remove("!  "+headerdb["cecill","footer"][num])
480                            num=num+1
481                        num=0
482                        for line in headerdb["accordAVBP","footer"]:
483                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["accordAVBP","footer"][num]
484                            num=num+1
485                           
486                           
487                    elif contenu[len(contenu)-1].startswith("!  knowledge of the OpenScience"):
488                        num=0
489                        for line in headerdb["openscience","footer"]:
490                            contenu.remove("!  "+headerdb["openscience","footer"][num])
491                            num=num+1
492                        num=0
493                        for line in headerdb["accordAVBP","footer"]:
494                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["accordAVBP","footer"][num]
495                            num=num+1
496                           
497                           
498                    else:
499                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
500                        num=0
501                        for line in headerdb["accordAVBP","footer"]:
502                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["accordAVBP","footer"][num]
503                            num=num+1
504                       
505                    mapping += ' / CERFACS'
506                   
507                   
508                ##### CECILL #####
509                           
510                elif 'CECILL' in mapp[ii]:
511                   
512                    ##### Header #####
513                   
514                    if contenu[0].startswith("!  This program"):
515                        contenu[0]="!  "+headerdb["cecill","header"]
516                    elif contenu[0].startswith("!  Ce programme"):
517                        contenu[0]="!  "+headerdb["cecill","header"]
518                    else:
519                        contenu[0]="!  "+headerdb["cecill","header"]+"\n\n"+contenu[0]
520                       
521                    ##### Footer #####
522                   
523                    if contenu[len(contenu)-1].startswith("!  accepte"):
524                        num=0
525                        for line in headerdb["accordAVBP","footer"]:
526                            contenu.remove("!  "+headerdb["accordAVBP","footer"][num])
527                            num=num+1
528                        num=0
529                        for line in headerdb["cecill","footer"]:
530                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["cecill","footer"][num]
531                            num=num+1
532                           
533                           
534                    elif contenu[len(contenu)-1].startswith("!  knowledge of the CeCILL-B"):
535                        num=0
536                        for line in headerdb["cecill","footer"]:
537                            contenu.remove("!  "+headerdb["cecill","footer"][num])
538                            num=num+1
539                        num=0
540                        for line in headerdb["cecill","footer"]:
541                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["cecill","footer"][num]
542                            num=num+1
543                           
544                           
545                    elif contenu[len(contenu)-1].startswith("!  knowledge of the OpenScience"):
546                        num=0
547                        for line in headerdb["openscience","footer"]:
548                            contenu.remove("!  "+headerdb["openscience","footer"][num])
549                            num=num+1
550                        num=0
551                        for line in headerdb["cecill","footer"]:
552                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["cecill","footer"][num]
553                            num=num+1
554                           
555                           
556                    else:
557                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
558                        num=0
559                        for line in headerdb["cecill","footer"]:
560                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["cecill","footer"][num]
561                            num=num+1
562                       
563                    mapping += ' / CECILL'
564                   
565                   
566                ##### OPENSCIENCE #####
567               
568                elif 'OPENSCIENCE' in mapp[ii]:
569                   
570                    ##### Header #####
571                   
572                    if contenu[0].startswith("!  This program"):
573                        contenu[0]="!  "+headerdb["openscience","header"]
574                    elif contenu[0].startswith("!  Ce programme"):
575                        contenu[0]="!  "+headerdb["openscience","header"]
576                    else:
577                        contenu[0]="!  "+headerdb["openscience","header"]+"\n\n"+contenu[0]
578                       
579                    ##### Footer #####
580                   
581                    if contenu[len(contenu)-1].startswith("!  accepte"):
582                        num=0
583                        for line in headerdb["accordAVBP","footer"]:
584                            contenu.remove("!  "+headerdb["accordAVBP","footer"][num])
585                            num=num+1
586                        num=0
587                        for line in headerdb["openscience","footer"]:
588                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["openscience","footer"][num]
589                            num=num+1
590                           
591                           
592                    elif contenu[len(contenu)-1].startswith("!  knowledge of the CeCILL-B"):
593                        num=0
594                        for line in headerdb["cecill","footer"]:
595                            contenu.remove("!  "+headerdb["cecill","footer"][num])
596                            num=num+1
597                        num=0
598                        for line in headerdb["openscience","footer"]:
599                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["openscience","footer"][num]
600                            num=num+1
601                           
602                           
603                    elif contenu[len(contenu)-1].startswith("!  knowledge of the OpenScience"):
604                        num=0
605                        for line in headerdb["openscience","footer"]:
606                            contenu.remove("!  "+headerdb["openscience","footer"][num])
607                            num=num+1
608                        num=0
609                        for line in headerdb["openscience","footer"]:
610                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["openscience","footer"][num]
611                            num=num+1
612                           
613                           
614                    else:
615                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
616                        num=0
617                        for line in headerdb["openscience","footer"]:
618                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n!  "+headerdb["openscience","footer"][num]
619                            num=num+1
620                       
621                    mapping += ' / OPENSCIENCE'
622                   
623                ##### Pas de licence #####
624               
625                elif 'NONE' in mapp[ii]:
626                   
627                    ##### Header #####
628                   
629                    if contenu[0].startswith("!  This program is under CECILL_B"):
630                        contenu.remove("!  "+headerdb["cecill","header"])
631                    elif contenu[0].startswith("!  This program is under OpenScience"):
632                        contenu.remove("!  "+headerdb["openscience","header"])
633                    elif contenu[0].startswith("!  Ce programme"):
634                        contenu.remove("!  "+headerdb["accordAVBP","header"])
635                       
636                    ##### Footer #####
637                   
638                    if contenu[len(contenu)-1].startswith("!  accepte"):
639                        num=0
640                        for line in headerdb["accordAVBP","footer"]:
641                            contenu.remove("!  "+headerdb["accordAVBP","footer"][num])
642                            num=num+1
643                           
644                    elif contenu[len(contenu)-1].startswith("!  knowledge of the CeCILL-B"):
645                        num=0
646                        for line in headerdb["cecill","footer"]:
647                            contenu.remove("!  "+headerdb["cecill","footer"][num])
648                            num=num+1
649                           
650                    elif contenu[len(contenu)-1].startswith("!  knowledge of the OpenScience"):
651                        num=0
652                        for line in headerdb["openscience","footer"]:
653                            contenu.remove("!  "+headerdb["openscience","footer"][num])
654                            num=num+1
655                           
656                    mapping += ' / NONE'
657                   
658                else:
659                    mapping += ' / PRE NONE'
660                           
661                ##### Ecriture #####
662               
663                mapping += '\n'
664                   
665                for k in range(len(contenu)):
666                    contenu[k]=contenu[k]+'\n'
667                    contenu3+=contenu[k]
668                   
669                   
670                   
671########## Extension tcl ##########
672               
673            elif fileExtension[i]=='.tcl':
674               
675                _tcl=_tcl+1
676               
677                mapping += completeName[i]+" "*(95-len(completeName[i]))+fileExtension[i]+" "*(15-len(fileExtension[i]))
678               
679                ##### CERFACS #####
680               
681                if 'CERFACS' in mapp[ii]:
682                   
683                    ###### Header #####
684                   
685                    if contenu[0].startswith("#  This program"):
686                        contenu[0]="#  "+headerdb["accordAVBP","header"]
687                    elif contenu[0].startswith("#  Ce programme"):
688                        contenu[0]="#  "+headerdb["accordAVBP","header"]
689                    else:
690                        contenu[0]="#  "+headerdb["accordAVBP","header"]+"\n\n"+contenu[0]
691                       
692                    ##### Footer #####
693                   
694                    if contenu[len(contenu)-1].startswith("#  accepte"):
695                        num=0
696                        for line in headerdb["accordAVBP","footer"]:
697                            contenu.remove("#  "+headerdb["accordAVBP","footer"][num])
698                            num=num+1
699                        num=0
700                        for line in headerdb["accordAVBP","footer"]:
701                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["accordAVBP","footer"][num]
702                            num=num+1
703                           
704                           
705                    elif contenu[len(contenu)-1].startswith("#  knowledge of the CeCILL-B"):
706                        num=0
707                        for line in headerdb["cecill","footer"]:
708                            contenu.remove("#  "+headerdb["cecill","footer"][num])
709                            num=num+1
710                        num=0
711                        for line in headerdb["accordAVBP","footer"]:
712                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["accordAVBP","footer"][num]
713                            num=num+1
714                           
715                           
716                    elif contenu[len(contenu)-1].startswith("#  knowledge of the OpenScience"):
717                        num=0
718                        for line in headerdb["openscience","footer"]:
719                            contenu.remove("#  "+headerdb["openscience","footer"][num])
720                            num=num+1
721                        num=0
722                        for line in headerdb["accordAVBP","footer"]:
723                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["accordAVBP","footer"][num]
724                            num=num+1
725                           
726                           
727                    else:
728                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
729                        num=0
730                        for line in headerdb["accordAVBP","footer"]:
731                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["accordAVBP","footer"][num]
732                            num=num+1
733                       
734                    mapping += ' / CERFACS'
735                   
736                   
737                ##### CECILL #####
738                           
739                elif 'CECILL' in mapp[ii]:
740                   
741                    ##### Header #####
742                   
743                    if contenu[0].startswith("#  This program"):
744                        contenu[0]="#  "+headerdb["cecill","header"]
745                    elif contenu[0].startswith("#  Ce programme"):
746                        contenu[0]="#  "+headerdb["cecill","header"]
747                    else:
748                        contenu[0]="#  "+headerdb["cecill","header"]+"\n\n"+contenu[0]
749                       
750                    ##### Footer #####
751                   
752                    if contenu[len(contenu)-1].startswith("#  accepte"):
753                        num=0
754                        for line in headerdb["accordAVBP","footer"]:
755                            contenu.remove("#  "+headerdb["accordAVBP","footer"][num])
756                            num=num+1
757                        num=0
758                        for line in headerdb["cecill","footer"]:
759                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["cecill","footer"][num]
760                            num=num+1
761                           
762                           
763                    elif contenu[len(contenu)-1].startswith("#  knowledge of the CeCILL-B"):
764                        num=0
765                        for line in headerdb["cecill","footer"]:
766                            contenu.remove("#  "+headerdb["cecill","footer"][num])
767                            num=num+1
768                        num=0
769                        for line in headerdb["cecill","footer"]:
770                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["cecill","footer"][num]
771                            num=num+1
772                           
773                           
774                    elif contenu[len(contenu)-1].startswith("#  knowledge of the OpenScience"):
775                        num=0
776                        for line in headerdb["openscience","footer"]:
777                            contenu.remove("#  "+headerdb["openscience","footer"][num])
778                            num=num+1
779                        num=0
780                        for line in headerdb["cecill","footer"]:
781                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["cecill","footer"][num]
782                            num=num+1
783                           
784                           
785                    else:
786                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
787                        num=0
788                        for line in headerdb["cecill","footer"]:
789                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["cecill","footer"][num]
790                            num=num+1
791                       
792                    mapping += ' / CECILL'
793                   
794                   
795                ##### OPENSCIENCE #####
796               
797                elif 'OPENSCIENCE' in mapp[ii]:
798                   
799                    ##### Header #####
800                   
801                    if contenu[0].startswith("#  This program"):
802                        contenu[0]="#  "+headerdb["openscience","header"]
803                    elif contenu[0].startswith("#  Ce programme"):
804                        contenu[0]="#  "+headerdb["openscience","header"]
805                    else:
806                        contenu[0]="#  "+headerdb["openscience","header"]+"\n\n"+contenu[0]
807                       
808                    ##### Footer #####
809                   
810                    if contenu[len(contenu)-1].startswith("#  accepte"):
811                        num=0
812                        for line in headerdb["accordAVBP","footer"]:
813                            contenu.remove("#  "+headerdb["accordAVBP","footer"][num])
814                            num=num+1
815                        num=0
816                        for line in headerdb["openscience","footer"]:
817                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["openscience","footer"][num]
818                            num=num+1
819                           
820                           
821                    elif contenu[len(contenu)-1].startswith("#  knowledge of the CeCILL-B"):
822                        num=0
823                        for line in headerdb["cecill","footer"]:
824                            contenu.remove("#  "+headerdb["cecill","footer"][num])
825                            num=num+1
826                        num=0
827                        for line in headerdb["openscience","footer"]:
828                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["openscience","footer"][num]
829                            num=num+1
830                           
831                           
832                    elif contenu[len(contenu)-1].startswith("#  knowledge of the OpenScience"):
833                        num=0
834                        for line in headerdb["openscience","footer"]:
835                            contenu.remove("#  "+headerdb["openscience","footer"][num])
836                            num=num+1
837                        num=0
838                        for line in headerdb["openscience","footer"]:
839                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["openscience","footer"][num]
840                            num=num+1
841                           
842                           
843                    else:
844                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n"
845                        num=0
846                        for line in headerdb["openscience","footer"]:
847                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n#  "+headerdb["openscience","footer"][num]
848                            num=num+1
849                       
850                    mapping += ' / OPENSCIENCE'
851               
852                ##### Pas de licence #####
853               
854                elif 'NONE' in mapp[ii]:
855                   
856                    ##### Header #####
857                   
858                    if contenu[0].startswith("#  This program is under CECILL_B"):
859                        contenu.remove("#  "+headerdb["cecill","header"])
860                    elif contenu[0].startswith("#  This program is under OpenScience"):
861                        contenu.remove("#  "+headerdb["openscience","header"])
862                    elif contenu[0].startswith("#  Ce programme"):
863                        contenu.remove("#  "+headerdb["accordAVBP","header"])
864                       
865                    ##### Footer #####
866                   
867                    if contenu[len(contenu)-1].startswith("#  accepte"):
868                        num=0
869                        for line in headerdb["accordAVBP","footer"]:
870                            contenu.remove("#  "+headerdb["accordAVBP","footer"][num])
871                            num=num+1
872                           
873                    elif contenu[len(contenu)-1].startswith("#  knowledge of the CeCILL-B"):
874                        num=0
875                        for line in headerdb["cecill","footer"]:
876                            contenu.remove("#  "+headerdb["cecill","footer"][num])
877                            num=num+1
878                           
879                    elif contenu[len(contenu)-1].startswith("#  knowledge of the OpenScience"):
880                        num=0
881                        for line in headerdb["openscience","footer"]:
882                            contenu.remove("#  "+headerdb["openscience","footer"][num])
883                            num=num+1
884                           
885                    mapping += ' / NONE'
886                   
887                else:
888                    mapping += ' / PRE NONE'
889                   
890                ##### Ecriture #####
891               
892                mapping += '\n'
893                   
894                for k in range(len(contenu)):
895                    contenu[k]=contenu[k]+'\n'
896                    contenu3+=contenu[k]
897                   
898# Extension html
899           
900            elif fileExtension[i]=='.html':
901               
902                _html=_html+1
903               
904                mapping += completeName[i]+" "*(95-len(completeName[i]))+fileExtension[i]+" "*(15-len(fileExtension[i]))
905               
906                ##### CERFACS #####
907               
908                if 'CERFACS' in mapp[ii]:
909                   
910                    ###### Header #####
911                   
912                    if contenu[0].startswith("<!--  This program"):
913                        contenu[0]="<!--  "+headerdb["accordAVBP","header"]+"  -->"
914                    elif contenu[0].startswith("<!--  Ce programme"):
915                        contenu[0]="<!--  "+headerdb["accordAVBP","header"]+"  -->"
916                    else:
917                        contenu[0]="<!--  "+headerdb["accordAVBP","header"]+"  -->\n\n"+contenu[0]
918                       
919                    ##### Footer #####
920                   
921                    if contenu[len(contenu)-2].startswith("accepte"):
922                        num=0
923                        for line in headerdb["accordAVBP","footer"]:
924                            contenu.remove(headerdb["accordAVBP","footer"][num])
925                            num=num+1
926                        num=0
927                        for line in headerdb["accordAVBP","footer"]:
928                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["accordAVBP","footer"][num]
929                            num=num+1
930                           
931                           
932                    elif contenu[len(contenu)-2].startswith("knowledge of the CeCILL-B"):
933                        num=0
934                        for line in headerdb["cecill","footer"]:
935                            contenu.remove(headerdb["cecill","footer"][num])
936                            num=num+1
937                        num=0
938                        for line in headerdb["accordAVBP","footer"]:
939                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["accordAVBP","footer"][num]
940                            num=num+1
941                           
942                           
943                    elif contenu[len(contenu)-2].startswith("knowledge of the OpenScience"):
944                        num=0
945                        for line in headerdb["openscience","footer"]:
946                            contenu.remove(headerdb["openscience","footer"][num])
947                            num=num+1
948                        num=0
949                        for line in headerdb["accordAVBP","footer"]:
950                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["accordAVBP","footer"][num]
951                            num=num+1
952                           
953                           
954                    else:
955                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n\n<!--"
956                        num=0
957                        for line in headerdb["accordAVBP","footer"]:
958                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n"+headerdb["accordAVBP","footer"][num]
959                            num=num+1
960                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n-->"
961                       
962                    mapping += ' / CERFACS'
963                   
964                   
965                ##### CECILL #####
966                           
967                elif 'CECILL' in mapp[ii]:
968                   
969                    ##### Header #####
970                   
971                    if contenu[0].startswith("<!--  This program"):
972                        contenu[0]="<!--  "+headerdb["cecill","header"]+"  -->"
973                    elif contenu[0].startswith("<!--  Ce programme"):
974                        contenu[0]="<!--  "+headerdb["cecill","header"]+"  -->"
975                    else:
976                        contenu[0]="<!--  "+headerdb["cecill","header"]++"  -->\n\n"+contenu[0]
977                       
978                    ##### Footer #####
979                   
980                    if contenu[len(contenu)-2].startswith("accepte"):
981                        num=0
982                        for line in headerdb["accordAVBP","footer"]:
983                            contenu.remove(headerdb["accordAVBP","footer"][num])
984                            num=num+1
985                        num=0
986                        for line in headerdb["cecill","footer"]:
987                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["cecill","footer"][num]
988                            num=num+1
989                           
990                           
991                    elif contenu[len(contenu)-2].startswith("knowledge of the CeCILL-B"):
992                        num=0
993                        for line in headerdb["cecill","footer"]:
994                            contenu.remove(headerdb["cecill","footer"][num])
995                            num=num+1
996                        num=0
997                        for line in headerdb["cecill","footer"]:
998                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["cecill","footer"][num]
999                            num=num+1
1000                           
1001                           
1002                    elif contenu[len(contenu)-2].startswith("knowledge of the OpenScience"):
1003                        num=0
1004                        for line in headerdb["openscience","footer"]:
1005                            contenu.remove(headerdb["openscience","footer"][num])
1006                            num=num+1
1007                        num=0
1008                        for line in headerdb["cecill","footer"]:
1009                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["cecill","footer"][num]
1010                            num=num+1
1011                           
1012                           
1013                    else:
1014                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n\n<!--"
1015                        num=0
1016                        for line in headerdb["cecill","footer"]:
1017                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n"+headerdb["cecill","footer"][num]
1018                            num=num+1
1019                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n-->"
1020                       
1021                    mapping += ' / CECILL'
1022                   
1023                   
1024                ##### OPENSCIENCE #####
1025               
1026                elif 'OPENSCIENCE' in mapp[ii]:
1027                   
1028                    ##### Header #####
1029                   
1030                    if contenu[0].startswith("<!--  This program"):
1031                        contenu[0]="<!--  "+headerdb["openscience","header"]+"  -->"
1032                    elif contenu[0].startswith("#  Ce programme"):
1033                        contenu[0]="<!--  "+headerdb["openscience","header"]+"  -->"
1034                    else:
1035                        contenu[0]="<!--  "+headerdb["openscience","header"]+"  -->\n\n"+contenu[0]
1036                       
1037                    ##### Footer #####
1038                   
1039                    if contenu[len(contenu)-2].startswith("accepte"):
1040                        num=0
1041                        for line in headerdb["accordAVBP","footer"]:
1042                            contenu.remove(headerdb["accordAVBP","footer"][num])
1043                            num=num+1
1044                        num=0
1045                        for line in headerdb["openscience","footer"]:
1046                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["openscience","footer"][num]
1047                            num=num+1
1048                           
1049                           
1050                    elif contenu[len(contenu)-2].startswith("knowledge of the CeCILL-B"):
1051                        num=0
1052                        for line in headerdb["cecill","footer"]:
1053                            contenu.remove(headerdb["cecill","footer"][num])
1054                            num=num+1
1055                        num=0
1056                        for line in headerdb["openscience","footer"]:
1057                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["openscience","footer"][num]
1058                            num=num+1
1059                           
1060                           
1061                    elif contenu[len(contenu)-2].startswith("knowledge of the OpenScience"):
1062                        num=0
1063                        for line in headerdb["openscience","footer"]:
1064                            contenu.remove(headerdb["openscience","footer"][num])
1065                            num=num+1
1066                        num=0
1067                        for line in headerdb["openscience","footer"]:
1068                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+"\n"+headerdb["openscience","footer"][num]
1069                            num=num+1
1070                           
1071                           
1072                    else:
1073                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n\n<!--"
1074                        num=0
1075                        for line in headerdb["openscience","footer"]:
1076                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n"+headerdb["openscience","footer"][num]
1077                            num=num+1
1078                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n-->"
1079                       
1080                    mapping += ' / OPENSCIENCE'
1081                   
1082                ##### Pas de licence #####
1083               
1084                elif 'NONE' in mapp[ii]:
1085                   
1086                    ##### Header #####
1087
1088                    if contenu[0].startswith("<!--  This program is under CECILL_B"):
1089                        contenu.remove("<!--  "+headerdb["cecill","header"]+"  -->")
1090                    elif contenu[0].startswith("<!--  This program is under OpenScience"):
1091                        contenu.remove("<!--  "+headerdb["openscience","header"]+"  -->")
1092                    elif contenu[0].startswith("<!--  Ce programme"):
1093                        contenu.remove("<!--  "+headerdb["accordAVBP","header"]+"  -->")
1094                       
1095                    ##### Footer #####
1096                   
1097                    if contenu[len(contenu)-2].startswith("accepte"):
1098                        num=0
1099                        for line in headerdb["accordAVBP","footer"]:
1100                            contenu.remove(headerdb["accordAVBP","footer"][num])
1101                            num=num+1
1102                        contenu[len(contenu)-2]=""
1103                        contenu[len(contenu)-1]=""
1104                           
1105                    elif contenu[len(contenu)-2].startswith("knowledge of the CeCILL-B"):
1106                        num=0
1107                        for line in headerdb["cecill","footer"]:
1108                            contenu.remove(headerdb["cecill","footer"][num])
1109                            num=num+1
1110                        contenu[len(contenu)-2]=""
1111                        contenu[len(contenu)-1]=""
1112                       
1113                    elif contenu[len(contenu)-1].startswith("knowledge of the OpenScience"):
1114                        num=0
1115                        for line in headerdb["openscience","footer"]:
1116                            contenu.remove(headerdb["openscience","footer"][num])
1117                            num=num+1
1118                        contenu[len(contenu)-2]=""
1119                        contenu[len(contenu)-1]=""
1120                       
1121                    mapping += ' / NONE'
1122                   
1123                else:
1124                    mapping += ' / PRE NONE'
1125                           
1126                ##### Ecriture #####
1127               
1128                mapping += '\n'
1129                   
1130                for k in range(len(contenu)):
1131                    contenu[k]=contenu[k]+'\n'
1132                    contenu3+=contenu[k]
1133                   
1134# Extension XML
1135                       
1136            elif fileExtension[i]=='.xml':
1137               
1138                _XML=_XML+1
1139               
1140                mapping += completeName[i]+" "*(95-len(completeName[i]))+fileExtension[i]+" "*(15-len(fileExtension[i]))
1141               
1142                # Si declaration xml, pas de commentaires avant
1143               
1144                gg=0
1145                if '?xml' in contenu[0]:
1146                        gg=1
1147               
1148                ##### CERFACS #####
1149               
1150                if 'CERFACS' in mapp[ii]:
1151                   
1152                    ###### Header #####
1153                     
1154                    if contenu[gg+1].startswith("<!--  This program"):
1155                        contenu[gg+1]="<!--  "+headerdb["accordAVBP","header"]+"  -->"
1156                    elif contenu[gg+1].startswith("<!--  Ce programme"):
1157                        contenu[gg+1]="<!--  "+headerdb["accordAVBP","header"]+"  -->"
1158                    else:
1159                        contenu[gg]="\n<!--  "+headerdb["accordAVBP","header"]+"  -->\n\n"+contenu[gg]
1160                       
1161                    ##### Footer #####
1162                   
1163                    if contenu[len(contenu)-2].startswith("accepte"):
1164                        num=0
1165                        for line in headerdb["accordAVBP","footer"]:
1166                            contenu.remove(headerdb["accordAVBP","footer"][num])
1167                            num=num+1
1168                        num=0
1169                        for line in headerdb["accordAVBP","footer"]:
1170                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["accordAVBP","footer"][num]
1171                            num=num+1
1172                           
1173                           
1174                    elif contenu[len(contenu)-2].startswith("knowledge of the CeCILL-B"):
1175                        num=0
1176                        for line in headerdb["cecill","footer"]:
1177                            contenu.remove(headerdb["cecill","footer"][num])
1178                            num=num+1
1179                        num=0
1180                        for line in headerdb["accordAVBP","footer"]:
1181                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["accordAVBP","footer"][num]
1182                            num=num+1
1183                           
1184                           
1185                    elif contenu[len(contenu)-2].startswith("knowledge of the OpenScience"):
1186                        num=0
1187                        for line in headerdb["openscience","footer"]:
1188                            contenu.remove(headerdb["openscience","footer"][num])
1189                            num=num+1
1190                        num=0
1191                        for line in headerdb["accordAVBP","footer"]:
1192                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["accordAVBP","footer"][num]
1193                            num=num+1
1194                           
1195                           
1196                    else:
1197                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n\n<!--"
1198                        num=0
1199                        for line in headerdb["accordAVBP","footer"]:
1200                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n"+headerdb["accordAVBP","footer"][num]
1201                            num=num+1
1202                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n-->"
1203                       
1204                    mapping += ' / CERFACS'
1205                   
1206                   
1207                ##### CECILL #####
1208                           
1209                elif 'CECILL' in mapp[ii]:
1210                   
1211                    ##### Header #####
1212                   
1213                    if contenu[gg+1].startswith("<!--  This program"):
1214                        contenu[gg+1]="<!--  "+headerdb["accordAVBP","header"]+"  -->"
1215                    elif contenu[gg+1].startswith("<!--  Ce programme"):
1216                        contenu[gg+1]="<!--  "+headerdb["accordAVBP","header"]+"  -->"
1217                    else:
1218                        contenu[gg]="\n<!--  "+headerdb["accordAVBP","header"]+"  -->\n\n"+contenu[gg]
1219                       
1220                    ##### Footer #####
1221                   
1222                    if contenu[len(contenu)-2].startswith("accepte"):
1223                        num=0
1224                        for line in headerdb["accordAVBP","footer"]:
1225                            contenu.remove(headerdb["accordAVBP","footer"][num])
1226                            num=num+1
1227                        num=0
1228                        for line in headerdb["cecill","footer"]:
1229                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["cecill","footer"][num]
1230                            num=num+1
1231                           
1232                           
1233                    elif contenu[len(contenu)-2].startswith("knowledge of the CeCILL-B"):
1234                        num=0
1235                        for line in headerdb["cecill","footer"]:
1236                            contenu.remove(headerdb["cecill","footer"][num])
1237                            num=num+1
1238                        num=0
1239                        for line in headerdb["cecill","footer"]:
1240                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["cecill","footer"][num]
1241                            num=num+1
1242                           
1243                           
1244                    elif contenu[len(contenu)-2].startswith("knowledge of the OpenScience"):
1245                        num=0
1246                        for line in headerdb["openscience","footer"]:
1247                            contenu.remove(headerdb["openscience","footer"][num])
1248                            num=num+1
1249                        num=0
1250                        for line in headerdb["cecill","footer"]:
1251                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["cecill","footer"][num]
1252                            num=num+1
1253                           
1254                           
1255                    else:
1256                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n\n<!--"
1257                        num=0
1258                        for line in headerdb["cecill","footer"]:
1259                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n"+headerdb["cecill","footer"][num]
1260                            num=num+1
1261                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n-->"
1262                       
1263                    mapping += ' / CECILL'
1264                   
1265                   
1266                ##### OPENSCIENCE #####
1267               
1268                elif 'OPENSCIENCE' in mapp[ii]:
1269                   
1270                    ##### Header #####
1271                   
1272                    if contenu[gg+1].startswith("<!--  This program"):
1273                        contenu[gg+1]="<!--  "+headerdb["accordAVBP","header"]+"  -->"
1274                    elif contenu[gg+1].startswith("<!--  Ce programme"):
1275                        contenu[gg+1]="<!--  "+headerdb["accordAVBP","header"]+"  -->"
1276                    else:
1277                        contenu[gg]="\n<!--  "+headerdb["accordAVBP","header"]+"  -->\n\n"+contenu[gg]
1278                       
1279                    ##### Footer #####
1280                   
1281                    if contenu[len(contenu)-2].startswith("accepte"):
1282                        num=0
1283                        for line in headerdb["accordAVBP","footer"]:
1284                            contenu.remove(headerdb["accordAVBP","footer"][num])
1285                            num=num+1
1286                        num=0
1287                        for line in headerdb["openscience","footer"]:
1288                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["openscience","footer"][num]
1289                            num=num+1
1290                           
1291                           
1292                    elif contenu[len(contenu)-2].startswith("knowledge of the CeCILL-B"):
1293                        num=0
1294                        for line in headerdb["cecill","footer"]:
1295                            contenu.remove(headerdb["cecill","footer"][num])
1296                            num=num+1
1297                        num=0
1298                        for line in headerdb["openscience","footer"]:
1299                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["openscience","footer"][num]
1300                            num=num+1
1301                           
1302                           
1303                    elif contenu[len(contenu)-2].startswith("knowledge of the OpenScience"):
1304                        num=0
1305                        for line in headerdb["openscience","footer"]:
1306                            contenu.remove(headerdb["openscience","footer"][num])
1307                            num=num+1
1308                        num=0
1309                        for line in headerdb["openscience","footer"]:
1310                            contenu[len(contenu)-2]=contenu[len(contenu)-2]+'\n'+headerdb["openscience","footer"][num]
1311                            num=num+1
1312                           
1313                           
1314                    else:
1315                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n\n\n<!--"
1316                        num=0
1317                        for line in headerdb["openscience","footer"]:
1318                            contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n"+headerdb["openscience","footer"][num]
1319                            num=num+1
1320                        contenu[len(contenu)-1]=contenu[len(contenu)-1]+"\n-->"
1321                       
1322                    mapping += ' / OPENSCIENCE'
1323                   
1324                ##### Pas de licence #####
1325               
1326                elif 'NONE' in mapp[ii]:
1327                   
1328                    ##### Header #####
1329                   
1330                    if contenu[gg+1].startswith("<!--  This program is under CECILL_B"):
1331                        contenu.remove("<!--  "+headerdb["cecill","header"]+"  -->")
1332                    elif contenu[gg+1].startswith("<!--  This program is under OpenScience"):
1333                        contenu.remove("<!--  "+headerdb["openscience","header"]+"  -->")
1334                    elif contenu[gg+1].startswith("<!--  Ce programme"):
1335                        contenu.remove("<!--  "+headerdb["accordAVBP","header"]+"  -->")
1336                       
1337                    ##### Footer #####
1338                   
1339                    if contenu[len(contenu)-2].startswith("accepte"):
1340                        num=0
1341                        for line in headerdb["accordAVBP","footer"]:
1342                            contenu.remove(headerdb["accordAVBP","footer"][num])
1343                            num=num+1
1344                        contenu[len(contenu)-2]=""
1345                        contenu[len(contenu)-1]=""
1346                           
1347                    elif contenu[len(contenu)-2].startswith("knowledge of the CeCILL-B"):
1348                        num=0
1349                        for line in headerdb["cecill","footer"]:
1350                            contenu.remove(headerdb["cecill","footer"][num])
1351                            num=num+1
1352                        contenu[len(contenu)-2]=""
1353                        contenu[len(contenu)-1]=""
1354                       
1355                    elif contenu[len(contenu)-1].startswith("knowledge of the OpenScience"):
1356                        num=0
1357                        for line in headerdb["openscience","footer"]:
1358                            contenu.remove(headerdb["openscience","footer"][num])
1359                            num=num+1
1360                        contenu[len(contenu)-2]=""
1361                        contenu[len(contenu)-1]=""
1362                       
1363                    mapping += ' / NONE'
1364                   
1365                else:
1366                    mapping += ' / PRE NONE'
1367                   
1368                ##### Ecriture #####
1369               
1370                mapping += '\n'
1371                   
1372                for k in range(len(contenu)):
1373                    contenu[k]=contenu[k]+'\n'
1374                    contenu3+=contenu[k]
1375                   
1376# Fichiers sans extension ou autre que voulue
1377           
1378            else:
1379                _others=_others+1
1380                mapping += completeName[i]+" "*(95-len(completeName[i]))+fileExtension[i]+" "*(15-len(fileExtension[i]))+' / NONE\n'
1381               
1382            contenu3=contenu3[0:-1]
1383            fichier=open(fileName[i]+fileExtension[i],"w")
1384            fichier.write(contenu3)
1385            fichier.close()
1386               
1387            ii=ii+1
1388           
1389# Si rajout de fichiers
1390           
1391        else:
1392            mapping += completeName[i]+" "*(95-len(completeName[i]))+fileExtension[i]+" "*(15-len(fileExtension[i]))+' / PRE NONE\n'
1393           
1394# Ecriture du mapping
1395   
1396    mapping += '\n\nFiles : \t\t\t\t\t\tLicenses :\n\t- f90 = '+str(_fortran)+' files\t\t\t\t\t\t- Cerfacs = '+str(_cerfacs)+' files\n\t- py = '
1397    mapping += str(_python)+' files\t\t\t\t\t\t- CeCILL-B = '+str(_cecill)+' files\n\t- XML = '+str(_XML)+' files\t\t\t\t\t\t- Openscience = '
1398    mapping += str(_openscience)+' files\n\t- tcl = '+str(_tcl)+' files\n\t- html = '+str(_html)+' files\n\t- Others = '+str(_others)+' files\n\nTOTAL = '
1399    mapping += str(_files)+' files\n\nInfo : PRE --> There still is a header in this file. Please, execute again mapping\n'
1400    mapping=mapping[0:-1]
1401    fichier=open('mapping.txt',"w")
1402    fichier.write(mapping)
1403    fichier.close()
1404   
1405else:
1406    for i in range(len(name)):
1407        (fileName[i], fileExtension[i]) = os.path.splitext(name[i])
1408        completeName[i]=path + '/' + fileName[i]
1409        mapping += completeName[i]+" "*(95-len(completeName[i]))+fileExtension[i]+" "*(15-len(fileExtension[i]))+' / PRE NONE\n'
1410    fichier=open('mapping.txt',"w")
1411    fichier.write(mapping)
1412    fichier.close()
1413
1414
1415
1416
1417
1418
1419#  Copyright CERFACS 2014
1420#   
1421#  antoine.dauptain@cerfacs.fr
1422#   
1423#  This software is a computer program whose purpose is to ensure technology
1424#  transfer between academia and industry.
1425#   
1426#  This software is governed by the CeCILL-B license under French law and
1427#  abiding by the rules of distribution of free software.  You can  use,
1428#  modify and/ or redistribute the software under the terms of the CeCILL-B
1429#  license as circulated by CEA, CNRS and INRIA at the following URL
1430#  "http://www.cecill.info".
1431#   
1432#  As a counterpart to the access to the source code and  rights to copy,
1433#  modify and redistribute granted by the license, users are provided only
1434#  with a limited warranty  and the software's author,  the holder of the
1435#  economic rights,  and the successive licensors  have only  limited
1436#  liability.
1437#   
1438#  In this respect, the user's attention is drawn to the risks associated
1439#  with loading,  using,  modifying and/or developing or reproducing the
1440#  software by the user in light of its specific status of free software,
1441#  that may mean  that it is complicated to manipulate,  and  that  also
1442#  therefore means  that it is reserved for developers  and  experienced
1443#  professionals having in-depth computer knowledge. Users are therefore
1444#  encouraged to load and test the software's suitability as regards their
1445#  requirements in conditions enabling the security of their systems and/or
1446#  data to be ensured and,  more generally, to use and operate it in the
1447#  same conditions as regards security.
1448#   
1449#  The fact that you are presently reading this means that you have had
1450#  knowledge of the CeCILL-B license and that you accept its terms.
Note: See TracBrowser for help on using the repository browser.