[Gelistirici] contrib

Uğur Çetin ugur.jnmbk at gmail.com
27 Eki 2006 Cum 10:22:17 EEST


Peki, o zaman pisidepo altındaki paketlere bu scripti uygulayalım. Bir paket
resmi depoya girerken bir satır daha ekleriz. İtirazı olan?

actionGPL.py:

#!/usr/bin/python
#
# Clear top comments in actions.py files and add this header:
'''
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/copyleft/gpl.txt.
'''
import os
import sys

class ActionsFile:
    content = []
    fileName = ''

    def __init__(self, fileName):
        '''Read the file, delete header, don't touch content'''
        self.fileName = fileName
        actionsFile = open(fileName)
        self.content = actionsFile.readlines()
        actionsFile.close()

        #clear initial comments
        while self.content[0][0] == '#':
            del self.content[0]
        self.__writeNewHeader()

    def __writeNewHeader(self):
        newHeader = ['#!/usr/bin/python\n', \
                     '# -*- coding: utf-8 -*-\n', \
                     '#\n', \
                     '# Licensed under the GNU General Public License,
version 2.\n', \
                     '# See the file http://www.gnu.org/copyleft/gpl.txt.\n'
]
        newHeader.extend(self.content)
        self.content = newHeader
    def flush(self):
        file = open(self.fileName, 'w')
        file.writelines(self.content)
        file.close()

if __name__ == '__main__':
    if len(sys.argv) != 2:
        print '''\
This script changes actions.py headers in the given working copy
Usage: %(sys.argv[0])s <directory>
'''

    for root, dirs, files in os.walk(sys.argv[1]):
        for file in files:
            if file == 'actions.py':
                filePath = os.path.join(root, file)
                f = ActionsFile(filePath)
                f.flush()
                print 'Finished %s' % filePath




26.10.2006 tarihinde Doruk Fisek <dfisek at fisek.com.tr> yazmış:
>
> Thu, 26 Oct 2006 20:21:22 +0300, "S.Çağlar Onur"
> <caglar at pardus.org.tr> :
>
> > #!/usr/bin/python
> > # -*- coding: utf-8 -*-
> > #
> > # Uğur Çetin <jnmbk at users.sourceforge.net>
> > Bu paketler resmi depoya alınırken header değiştirip (c) UEKAE'ye mi
> > devr edilecek yoksa böyle kalacak mı? Bu konudaki politikamız ne?
> UEKAE kismini bilemem ama GPL headerlari olmasi gerekli bence. Lisansi
> belli degil betiklerin.
>
>                    Doruk
>
> --
> FISEK ENSTITUSU - http://www.fisek.com.tr
> Ankara : 0.312.3857026  /  Istanbul : 0.216.4284693
> _______________________________________________
> Gelistirici mailing list
> Gelistirici at uludag.org.tr
> http://liste.uludag.org.tr/mailman/listinfo/gelistirici
>
-------------- sonraki bölüm --------------
Bir HTML eklentisi temizlendi...
URL: <http://liste.pardus.org.tr/gelistirici/attachments/20061027/65738775/attachment-0001.htm>


Gelistirici mesaj listesiyle ilgili daha fazla bilgi