2017-09-05 17:49:55 +03:00
import re
2017-09-15 12:47:08 +03:00
from itertools import chain
from os . path import basename
from os . path import dirname
from os . path import join
from os . path import splitext
2017-03-12 14:22:31 +03:00
from distutils . core import setup
2017-09-15 12:47:08 +03:00
from distutils . command . build import build
from setuptools . command . develop import develop
from setuptools . command . easy_install import easy_install
from setuptools . command . install_lib import install_lib
2017-03-22 20:28:41 +03:00
2017-09-15 12:47:08 +03:00
class BuildWithPTH ( build ) :
def run ( self ) :
build . run ( self )
path = join ( dirname ( __file__ ) , ' better_exceptions_hook.pth ' )
dest = join ( self . build_lib , basename ( path ) )
self . copy_file ( path , dest )
class EasyInstallWithPTH ( easy_install ) :
def run ( self ) :
easy_install . run ( self )
path = join ( dirname ( __file__ ) , ' better_exceptions_hook.pth ' )
dest = join ( self . install_dir , basename ( path ) )
self . copy_file ( path , dest )
class InstallLibWithPTH ( install_lib ) :
def run ( self ) :
install_lib . run ( self )
path = join ( dirname ( __file__ ) , ' better_exceptions_hook.pth ' )
dest = join ( self . install_dir , basename ( path ) )
self . copy_file ( path , dest )
self . outputs = [ dest ]
def get_outputs ( self ) :
return chain ( install_lib . get_outputs ( self ) , self . outputs )
class DevelopWithPTH ( develop ) :
def run ( self ) :
develop . run ( self )
path = join ( dirname ( __file__ ) , ' better_exceptions_hook.pth ' )
dest = join ( self . install_dir , basename ( path ) )
self . copy_file ( path , dest )
with open ( ' better_exceptions/__init__.py ' , ' r ' ) as file :
2017-09-05 17:49:55 +03:00
version = re . search ( r ' ^__version__ \ s*= \ s*[ \' " ]([^ \' " ]*)[ \' " ] ' ,
file . read ( ) , re . MULTILINE ) . group ( 1 )
2017-03-22 20:28:41 +03:00
2017-03-12 14:22:31 +03:00
setup (
name = ' better_exceptions ' ,
2017-09-15 12:47:08 +03:00
packages = [ ' better_exceptions ' ] ,
2017-09-05 17:49:55 +03:00
version = version ,
2017-03-12 14:22:31 +03:00
description = ' Pretty and helpful exceptions, automatically ' ,
author = ' Josh Junon ' ,
author_email = ' josh@junon.me ' ,
2017-03-12 14:25:47 +03:00
url = ' https://github.com/qix-/better-exceptions ' ,
2017-09-05 17:49:55 +03:00
download_url = ' https://github.com/qix-/better-exceptions/archive/ {} .tar.gz ' . format ( version ) ,
2017-03-12 14:22:31 +03:00
keywords = [ ' pretty ' , ' better ' , ' exceptions ' , ' exception ' , ' error ' , ' local ' , ' debug ' , ' debugging ' , ' locals ' ] ,
classifiers = [ ] ,
2017-03-23 04:41:02 +03:00
extras_require = {
' :sys_platform== " win32 " ' : [ ' colorama ' ]
2017-09-15 12:47:08 +03:00
} ,
# This all comes from pytest-cov repository:
# https://github.com/pytest-dev/pytest-cov/blob/cde7c378b6a1971957759f42ac91e2860b41cf89/setup.py
cmdclass = {
' build ' : BuildWithPTH ,
' easy_install ' : EasyInstallWithPTH ,
' install_lib ' : InstallLibWithPTH ,
' develop ' : DevelopWithPTH ,
2017-03-23 04:41:02 +03:00
}
2017-03-12 14:22:31 +03:00
)