[337] | 1 | #!/usr/bin/python |
---|
| 2 | |
---|
| 3 | # |
---|
| 4 | # PdfShuffler 0.6.0 - GTK+ based utility for splitting, rearrangement and |
---|
| 5 | # modification of PDF documents. |
---|
| 6 | # Copyright (C) 2008-2012 Konstantinos Poulios |
---|
| 7 | # <https://sourceforge.net/projects/pdfshuffler> |
---|
| 8 | # |
---|
| 9 | # This program is free software; you can redistribute it and/or modify |
---|
| 10 | # it under the terms of the GNU General Public License as published by |
---|
| 11 | # the Free Software Foundation; either version 3 of the License, or |
---|
| 12 | # (at your option) any later version. |
---|
| 13 | # |
---|
| 14 | # This program is distributed in the hope that it will be useful, |
---|
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | # GNU General Public License for more details. |
---|
| 18 | # |
---|
| 19 | # You should have received a copy of the GNU General Public License along |
---|
| 20 | # with this program; if not, write to the Free Software Foundation, Inc., |
---|
| 21 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
---|
| 22 | # |
---|
| 23 | |
---|
| 24 | import os |
---|
| 25 | import re |
---|
| 26 | from distutils.core import setup |
---|
| 27 | |
---|
| 28 | data_files=[('share/pdfshuffler', ['data/pdfshuffler.ui']), |
---|
| 29 | ('share/applications', ['data/pdfshuffler.desktop']), |
---|
| 30 | ('share/man/man1', ['doc/pdfshuffler.1']), |
---|
| 31 | ('share/pixmaps', ['data/pdfshuffler.png']), |
---|
| 32 | ('share/pdfshuffler/icons/hicolor/scalable', |
---|
| 33 | ['data/pdfshuffler.svg']) ] |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | # Freshly generate .mo from .po, add to data_files: |
---|
| 37 | if os.path.isdir('mo/'): |
---|
| 38 | os.system ('rm -r mo/') |
---|
| 39 | for name in os.listdir('po'): |
---|
| 40 | m = re.match(r'(.+)\.po$', name) |
---|
| 41 | if m != None: |
---|
| 42 | lang = m.group(1) |
---|
| 43 | out_dir = 'mo/%s/LC_MESSAGES' % lang |
---|
| 44 | out_name = os.path.join(out_dir, 'pdfshuffler.mo') |
---|
| 45 | install_dir = 'share/locale/%s/LC_MESSAGES/' % lang |
---|
| 46 | os.makedirs(out_dir) |
---|
| 47 | os.system('msgfmt -o %s po/%s' % (out_name, name)) |
---|
| 48 | data_files.append((install_dir, [out_name])) |
---|
| 49 | |
---|
| 50 | setup(name='pdfshuffler', |
---|
| 51 | version='0.6.0', |
---|
| 52 | author='Konstantinos Poulios', |
---|
| 53 | author_email='logari81 at gmail dot com', |
---|
| 54 | description='A simple application for PDF Merging, Rearranging, and Splitting', |
---|
| 55 | url = 'https://sourceforge.net/projects/pdfshuffler', |
---|
| 56 | license='GNU GPL-3', |
---|
| 57 | scripts=['bin/pdfshuffler'], |
---|
| 58 | packages=['pdfshuffler'], |
---|
| 59 | data_files=data_files |
---|
| 60 | ) |
---|
| 61 | |
---|
| 62 | # Clean up temporary files |
---|
| 63 | if os.path.isdir('mo/'): |
---|
| 64 | os.system ('rm -r mo/') |
---|
| 65 | if os.path.isdir('build/'): |
---|
| 66 | os.system ('rm -r build/') |
---|
| 67 | |
---|