~gwendal-lebihan-dev/torrent-search/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/python
# -*- coding=utf-8 -*-

"""
    This file is part of Torrent Search.
    
    Torrent Search is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Torrent Search is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

import os

PATH=os.path.split(__file__)[0]
SRCPATH=os.path.abspath(PATH+"/manpages")
DESTPATH=os.path.abspath(PATH+"/share/man")

if __name__=="__main__":
   os.chdir(SRCPATH)
   for i in os.listdir(SRCPATH):
      if i[-1]!="~" and i[0]!='.':
         prg,lang,ext=i.split('.')
         if lang=="en":
            path=DESTPATH+"/man1/"
         else:
            path=DESTPATH+"/"+lang+"/man1/"
         if not os.path.exists(path):
            os.system('mkdir -p "%s"'%path)
         os.system('gzip -c "%s" > "%s"'%(i,path+"torrent-search.1.gz"))