1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3 4 5"""lfm v3.1 - (C) 2001-17, by Iñigo Serna <inigoserna@gmail.com> 6 7'Last File Manager' is a powerful file manager for UNIX console. 8It has a curses interface and it's written in Python version 3.4+. 9Released under GNU Public License, read COPYING file for more details. 10""" 11 12 13import os 14from distutils.core import setup 15from os.path import join 16from sys import argv, exit, prefix, version_info 17 18 19DOC_FILES = ['COPYING', 'README', 'NEWS', 'TODO'] 20CONFIG_FILES = ['etc/lfm-default.keys', 'etc/lfm-default.theme'] 21MAN_FILES = ['lfm.1'] 22 23classifiers = """\ 24Development Status :: 5 - Production/Stable 25Environment :: Console :: Curses 26Intended Audience :: End Users/Desktop 27Intended Audience :: System Administrators 28License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) 29Natural Language :: English 30Operating System :: POSIX 31Operating System :: Unix 32Programming Language :: Python :: 3 33Topic :: Desktop Environment :: File Managers 34Topic :: System :: Filesystems 35Topic :: System :: Shells 36Topic :: System :: System Shells 37Topic :: Utilities 38""" 39 40 41# check python version 42ver = (version_info.major, version_info.minor) 43if ver < (3, 4): 44 print('ERROR: Python 3.4 or higher is required to run lfm.') 45 exit(-1) 46 47# to avoid bug in pip 7.x. See https://bitbucket.org/pypa/wheel/issues/92 48if 'bdist_wheel' in argv: 49 raise RuntimeError("This setup.py does not support wheels") 50 51import shutil 52try: 53 try: 54 os.mkdir('lfm/doc') 55 for f in DOC_FILES: 56 shutil.copy2(f, 'lfm/doc') 57 os.symlink('../etc', 'lfm/etc') 58 except: 59 pass 60 setup(name='lfm', 61 version='3.1', 62 description=__doc__.split("\n")[2], 63 long_description='\n'.join(__doc__.split("\n")[2:]).strip(), 64 author='Iñigo Serna', 65 author_email='inigoserna@gmail.com', 66 url='https://inigo.katxi.org/devel/lfm', 67 platforms='POSIX', 68 keywords=['file manager shell cli'], 69 classifiers=filter(None, classifiers.split("\n")), 70 license='GPL3+', 71 packages=['lfm'], 72 scripts=['lfm/lfm'], 73 data_files=[(join(prefix, 'share/man/man1'), MAN_FILES)], 74 package_data={'': CONFIG_FILES + [join('doc', f) for f in DOC_FILES]}, 75 ) 76finally: 77 shutil.rmtree('lfm/doc') 78 try: 79 os.unlink('lfm/etc') 80 except IsADirectoryError: 81 pass 82