2015-03-07 13:35:01 -06:00
|
|
|
#!/usr/bin/env python
|
2015-03-23 01:29:37 -05:00
|
|
|
# coding=utf-8
|
2015-03-07 12:02:04 -06:00
|
|
|
"""The xonsh installer."""
|
2015-03-07 13:35:01 -06:00
|
|
|
from __future__ import print_function, unicode_literals
|
2015-03-07 12:02:04 -06:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
try:
|
|
|
|
from setuptools import setup
|
2015-03-09 22:42:34 -05:00
|
|
|
from setuptools.command.sdist import sdist
|
2015-03-15 20:48:13 -05:00
|
|
|
from setuptools.command.install import install
|
2015-04-06 23:21:03 -05:00
|
|
|
from setuptools.command.develop import develop
|
2015-03-07 12:02:04 -06:00
|
|
|
HAVE_SETUPTOOLS = True
|
|
|
|
except ImportError:
|
|
|
|
from distutils.core import setup
|
2015-03-15 20:48:13 -05:00
|
|
|
from distutils.command.sdist import sdist as sdist
|
|
|
|
from distutils.command.install import install as install
|
2015-03-07 12:02:04 -06:00
|
|
|
HAVE_SETUPTOOLS = False
|
|
|
|
|
2015-03-24 16:07:37 -04:00
|
|
|
from xonsh import __version__ as XONSH_VERSION
|
2015-03-07 12:09:30 -06:00
|
|
|
|
2015-03-07 13:24:44 -06:00
|
|
|
TABLES = ['xonsh/lexer_table.py', 'xonsh/parser_table.py']
|
|
|
|
|
|
|
|
def clean_tables():
|
|
|
|
for f in TABLES:
|
|
|
|
if os.path.isfile(f):
|
|
|
|
os.remove(f)
|
|
|
|
print('Remove ' + f)
|
|
|
|
|
|
|
|
def build_tables():
|
|
|
|
print('Building lexer and parser tables.')
|
|
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
|
|
from xonsh.parser import Parser
|
|
|
|
Parser(lexer_table='lexer_table', yacc_table='parser_table',
|
|
|
|
outputdir='xonsh')
|
|
|
|
sys.path.pop(0)
|
|
|
|
|
2015-03-09 22:42:34 -05:00
|
|
|
class xinstall(install):
|
|
|
|
def run(self):
|
|
|
|
clean_tables()
|
|
|
|
build_tables()
|
|
|
|
install.run(self)
|
|
|
|
|
|
|
|
class xsdist(sdist):
|
|
|
|
def make_release_tree(self, basedir, files):
|
|
|
|
clean_tables()
|
|
|
|
build_tables()
|
|
|
|
sdist.make_release_tree(self, basedir, files)
|
|
|
|
|
2015-04-06 23:21:03 -05:00
|
|
|
if HAVE_SETUPTOOLS:
|
|
|
|
class xdevelop(develop):
|
|
|
|
def run(self):
|
|
|
|
clean_tables()
|
|
|
|
build_tables()
|
|
|
|
install.run(self)
|
|
|
|
|
|
|
|
|
2015-03-07 12:02:04 -06:00
|
|
|
def main():
|
2015-03-12 20:43:06 -05:00
|
|
|
if sys.version_info[0] < 3:
|
|
|
|
sys.exit('xonsh currently requires Python 3.4+')
|
2015-03-23 01:40:44 -05:00
|
|
|
try:
|
|
|
|
print(logo)
|
|
|
|
except UnicodeEncodeError:
|
|
|
|
pass
|
2015-03-18 10:38:16 -07:00
|
|
|
with open(os.path.join(os.path.dirname(__file__), 'README.rst'), 'r') as f:
|
2015-03-07 12:09:30 -06:00
|
|
|
readme = f.read()
|
|
|
|
skw = dict(
|
|
|
|
name='xonsh',
|
|
|
|
description='an exotic, usable shell',
|
|
|
|
long_description=readme,
|
|
|
|
license='BSD',
|
2015-03-24 16:07:37 -04:00
|
|
|
version=XONSH_VERSION,
|
2015-03-07 12:09:30 -06:00
|
|
|
author='Anthony Scopatz',
|
|
|
|
maintainer='Anthony Scopatz',
|
|
|
|
author_email='scopatz@gmail.com',
|
|
|
|
url='https://github.com/scopatz/xonsh',
|
|
|
|
platforms='Cross Platform',
|
2015-04-02 21:08:17 -05:00
|
|
|
classifiers=['Programming Language :: Python :: 3'],
|
2015-03-07 12:09:30 -06:00
|
|
|
packages=['xonsh'],
|
2015-03-07 12:11:43 -06:00
|
|
|
scripts=['scripts/xonsh'],
|
2015-03-09 22:42:34 -05:00
|
|
|
cmdclass={'install': xinstall, 'sdist': xsdist},
|
2015-03-07 12:09:30 -06:00
|
|
|
)
|
2015-03-09 22:42:34 -05:00
|
|
|
if HAVE_SETUPTOOLS:
|
|
|
|
skw['setup_requires'] = ['ply']
|
|
|
|
skw['install_requires'] = ['ply']
|
2015-03-30 20:50:20 -05:00
|
|
|
skw['entry_points'] = {
|
|
|
|
'pygments.lexers': ['xonsh = xonsh.pyghooks:XonshLexer',
|
|
|
|
'xonshcon = xonsh.pyghooks:XonshConsoleLexer',
|
|
|
|
],
|
|
|
|
}
|
2015-04-06 23:21:03 -05:00
|
|
|
skw['cmdclass']['develop'] = xdevelop
|
2015-03-07 12:02:04 -06:00
|
|
|
setup(**skw)
|
|
|
|
|
2015-03-07 17:32:13 -06:00
|
|
|
logo = """
|
|
|
|
╓██▄
|
|
|
|
╙██▀██╕
|
|
|
|
▐██4Φ█▀█▌
|
|
|
|
²██▄███▀██^██
|
|
|
|
-███╩▀ " ╒▄█████▀█
|
|
|
|
║██▀▀W╤▄▀ ▐║█╘ ╝█
|
|
|
|
▄m▀%Φ▀▀ ╝*" ,α█████▓▄,▄▀Γ"▀╕
|
|
|
|
"▀██¼" ▄═╦█╟║█▀ ╓ `^` ,▄ ╢╕
|
|
|
|
,▀╫M█▐j╓╟▀ ╔▓▄█▀ '║ ╔ ╣║▌ ▀▄
|
|
|
|
▄m▀▀███╬█╝▀ █▀^ "ÜM j▐╟╫╨▒ ╙▀≡═╤═m▀╗
|
|
|
|
█æsæ╓ ╕, ,▄Ä ▐'╕H LU ║║╠╫Å^2=⌐ █
|
|
|
|
▄æ%Å███╠█ª╙▄█▀ $1╙ ║║╟╫╩*T▄ ▌
|
|
|
|
╙╗%▄,╦██▌█▌█╢M ╕ M║║║║█═⌐ⁿ"^ ╫
|
|
|
|
╙╣▀████@█░█ ▌╕╕ ` ▌║▐▐║█D═≈⌐¬ⁿ s ║⌐
|
|
|
|
╙╬███▓║█` ▌╚ ╕ ╕▌║▐▐╣▌⌐*▒▒Dù` ▐▌
|
|
|
|
╙╬██╨U█ ╟ $ ▌ ▌▌▐▐▐M█▄═≤⌐% ╓⌐ ▌
|
|
|
|
║║█▄▌║ ╟ ▌ ▌M▐▐▐M█▀▒▒▒22, ▐▌
|
|
|
|
███╙^▌ ║ ▌ ⌐M▐▐▐M█≤⌐⌐¬── ▐M
|
|
|
|
║██ ▌╙ ╓ H║ ▌╒ M║▐▐M█"^^^^^"ⁿ ║
|
|
|
|
██╕╙@▓ ╕ ▌║ H' ║▐▐▐█══=.,,, █
|
|
|
|
╙█▓╔╚╚█ ╠ ▌└╒ ▌▐ ╚║║║▀****ⁿ - ╓▌
|
|
|
|
╙█▌¼V╚▌ ▌ ╕ ▌ ║╒ ║ ▌▒╠█▀≤≤≤≤≤⌐ █
|
|
|
|
╙█▌╔█╚▌ ┘ M ▌║ ╫ UUM██J^^" ▐▌
|
|
|
|
╙██╙█╙▌ ╕$j ▐⌐▌ ▌║╝╟█Å%%%≈═ █
|
|
|
|
╙╣█╣█^▌ ╠║▐ ║ ▌▐.DU██^[""ⁿ -╒▌
|
|
|
|
▀█▄█`▌ ░M▀ ▌▐ Å£╝╝█╜%≈═╓""w ⁿ⌐ █
|
|
|
|
`▀▄▀`▌ ▌█▐⌐║▐UW╖██%≤═░*─ =z ▄Γ
|
|
|
|
╙██╙▄▌█ ▌Å╛╣██╨%╤ƒⁿ= -` ▄┘
|
|
|
|
█▌╢▓▌▌ W £6█╤,"ⁿ ` ▄≡▀▀▀
|
|
|
|
█"█▌▌╟Å╓█╓█▀%` ▄▀
|
|
|
|
╙▌██`▒U▓U█%╗* █
|
|
|
|
▌╫║ ▌ÅÅ║▀╛¬` `"█
|
|
|
|
▌╫ ╫╟ █▄ ~╦%▒╥4^
|
|
|
|
▌▌ "M█ `▀╕ X╕"╗▄▀^
|
|
|
|
█▌ ╓M ╙▀e▀▀^
|
|
|
|
╙██▄▄▀
|
|
|
|
^^
|
|
|
|
"""
|
|
|
|
|
2015-03-07 12:02:04 -06:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|
2015-03-07 17:32:13 -06:00
|
|
|
|