2016-10-02 12:59:27 -04:00
|
|
|
#!/usr/bin/env python3
|
2015-11-16 15:06:57 -08:00
|
|
|
# -*- coding: ascii -*-
|
2015-03-07 12:02:04 -06:00
|
|
|
"""The xonsh installer."""
|
2015-11-16 15:06:57 -08:00
|
|
|
# Note: Do not embed any non-ASCII characters in this file until pip has been
|
2016-06-28 12:29:42 +08:00
|
|
|
# fixed. See https://github.com/xonsh/xonsh/issues/487.
|
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
|
2015-09-30 00:56:14 -04:00
|
|
|
import json
|
2016-06-26 09:46:43 -04:00
|
|
|
import subprocess
|
2016-02-25 17:57:29 -05:00
|
|
|
|
2015-03-07 12:02:04 -06:00
|
|
|
try:
|
2016-02-25 17:53:59 -05:00
|
|
|
from tempfile import TemporaryDirectory
|
2016-02-25 17:57:29 -05:00
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
try:
|
2015-03-07 12:02:04 -06:00
|
|
|
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
|
2016-05-13 22:13:09 +01:00
|
|
|
from setuptools.command.install_scripts import install_scripts
|
2018-08-30 09:17:34 -05:00
|
|
|
|
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
|
2016-05-13 22:13:09 +01:00
|
|
|
from distutils.command.install_scripts import install_scripts
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2015-03-07 12:02:04 -06:00
|
|
|
HAVE_SETUPTOOLS = False
|
|
|
|
|
2015-09-30 00:56:14 -04:00
|
|
|
try:
|
2015-11-08 21:15:08 +01:00
|
|
|
from jupyter_client.kernelspec import KernelSpecManager
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2015-09-30 00:56:14 -04:00
|
|
|
HAVE_JUPYTER = True
|
|
|
|
except ImportError:
|
|
|
|
HAVE_JUPYTER = False
|
|
|
|
|
2015-03-07 12:09:30 -06:00
|
|
|
|
2018-08-30 09:17:34 -05:00
|
|
|
TABLES = [
|
|
|
|
"xonsh/lexer_table.py",
|
|
|
|
"xonsh/parser_table.py",
|
|
|
|
"xonsh/__amalgam__.py",
|
|
|
|
"xonsh/completers/__amalgam__.py",
|
|
|
|
"xonsh/history/__amalgam__.py",
|
|
|
|
"xonsh/prompt/__amalgam__.py",
|
|
|
|
]
|
2015-03-07 13:24:44 -06:00
|
|
|
|
2015-09-30 15:26:44 +02:00
|
|
|
|
2015-03-07 13:24:44 -06:00
|
|
|
def clean_tables():
|
2015-11-16 15:06:57 -08:00
|
|
|
"""Remove the lexer/parser modules that are dynamically created."""
|
2015-03-07 13:24:44 -06:00
|
|
|
for f in TABLES:
|
|
|
|
if os.path.isfile(f):
|
|
|
|
os.remove(f)
|
2018-08-30 09:17:34 -05:00
|
|
|
print("Removed " + f)
|
2015-03-07 13:24:44 -06:00
|
|
|
|
2015-09-30 00:56:14 -04:00
|
|
|
|
2018-08-30 09:17:34 -05:00
|
|
|
os.environ["XONSH_DEBUG"] = "1"
|
2016-07-20 22:07:45 +02:00
|
|
|
from xonsh import __version__ as XONSH_VERSION
|
2016-07-18 11:30:57 +02:00
|
|
|
|
2016-06-15 00:44:01 -04:00
|
|
|
|
2016-07-23 15:33:41 +03:00
|
|
|
def amalgamate_source():
|
2016-07-24 17:26:43 +00:00
|
|
|
"""Amalgamates source files."""
|
2016-07-23 20:48:34 +03:00
|
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
2016-06-24 16:35:11 -04:00
|
|
|
try:
|
|
|
|
import amalgamate
|
|
|
|
except ImportError:
|
2018-08-30 09:17:34 -05:00
|
|
|
print("Could not import amalgamate, skipping.", file=sys.stderr)
|
2016-06-24 16:35:11 -04:00
|
|
|
return
|
2018-08-30 09:17:34 -05:00
|
|
|
amalgamate.main(
|
|
|
|
[
|
|
|
|
"amalgamate",
|
|
|
|
"--debug=XONSH_DEBUG",
|
|
|
|
"xonsh",
|
|
|
|
"xonsh.completers",
|
|
|
|
"xonsh.history",
|
|
|
|
"xonsh.prompt",
|
|
|
|
]
|
|
|
|
)
|
2016-07-23 20:48:34 +03:00
|
|
|
sys.path.pop(0)
|
2016-06-24 16:35:11 -04:00
|
|
|
|
|
|
|
|
2015-03-07 13:24:44 -06:00
|
|
|
def build_tables():
|
2015-11-16 15:06:57 -08:00
|
|
|
"""Build the lexer/parser modules."""
|
2018-08-30 09:17:34 -05:00
|
|
|
print("Building lexer and parser tables.")
|
2016-07-23 20:48:34 +03:00
|
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
2015-03-07 13:24:44 -06:00
|
|
|
from xonsh.parser import Parser
|
2018-08-30 09:17:34 -05:00
|
|
|
|
|
|
|
Parser(
|
|
|
|
lexer_table="lexer_table",
|
|
|
|
yacc_table="parser_table",
|
|
|
|
outputdir="xonsh",
|
|
|
|
yacc_debug=True,
|
|
|
|
)
|
2016-07-23 20:48:34 +03:00
|
|
|
sys.path.pop(0)
|
2015-03-07 13:24:44 -06:00
|
|
|
|
2015-09-30 00:56:14 -04:00
|
|
|
|
2016-05-22 17:51:42 -04:00
|
|
|
def install_jupyter_hook(prefix=None, root=None):
|
2015-11-16 15:06:57 -08:00
|
|
|
"""Make xonsh available as a Jupyter kernel."""
|
2015-09-30 00:56:14 -04:00
|
|
|
if not HAVE_JUPYTER:
|
2018-08-30 09:17:34 -05:00
|
|
|
print(
|
|
|
|
"Could not install Jupyter kernel spec, please install " "Jupyter/IPython."
|
|
|
|
)
|
2015-09-30 00:56:14 -04:00
|
|
|
return
|
2018-08-30 09:17:34 -05:00
|
|
|
spec = {
|
|
|
|
"argv": [
|
|
|
|
sys.executable,
|
|
|
|
"-m",
|
|
|
|
"xonsh.jupyter_kernel",
|
|
|
|
"-f",
|
|
|
|
"{connection_file}",
|
|
|
|
],
|
|
|
|
"display_name": "Xonsh",
|
|
|
|
"language": "xonsh",
|
|
|
|
"codemirror_mode": "shell",
|
|
|
|
}
|
2016-04-25 11:59:48 +02:00
|
|
|
with TemporaryDirectory() as d:
|
|
|
|
os.chmod(d, 0o755) # Starts off as 700, not user readable
|
2018-08-30 09:17:34 -05:00
|
|
|
if sys.platform == "win32":
|
2015-09-30 15:26:44 +02:00
|
|
|
# Ensure that conda-build detects the hard coded prefix
|
2018-08-30 09:17:34 -05:00
|
|
|
spec["argv"][0] = spec["argv"][0].replace(os.sep, os.altsep)
|
|
|
|
with open(os.path.join(d, "kernel.json"), "w") as f:
|
2015-09-30 00:56:14 -04:00
|
|
|
json.dump(spec, f, sort_keys=True)
|
2018-08-30 09:17:34 -05:00
|
|
|
if "CONDA_BUILD" in os.environ:
|
2016-05-22 17:51:42 -04:00
|
|
|
prefix = sys.prefix
|
2018-08-30 09:17:34 -05:00
|
|
|
if sys.platform == "win32":
|
2016-05-22 17:51:42 -04:00
|
|
|
prefix = prefix.replace(os.sep, os.altsep)
|
2018-08-30 09:17:34 -05:00
|
|
|
user = "--user" in sys.argv
|
|
|
|
print("Installing Jupyter kernel spec:")
|
|
|
|
print(" root: {0!r}".format(root))
|
|
|
|
print(" prefix: {0!r}".format(prefix))
|
|
|
|
print(" as user: {0}".format(user))
|
2016-11-03 14:27:57 +01:00
|
|
|
if root and prefix:
|
|
|
|
# os.path.join isn't used since prefix is probably absolute
|
|
|
|
prefix = root + prefix
|
2018-08-30 09:17:34 -05:00
|
|
|
print(" combined prefix {0!r}".format(prefix))
|
2016-04-25 11:59:48 +02:00
|
|
|
KernelSpecManager().install_kernel_spec(
|
2018-08-30 09:17:34 -05:00
|
|
|
d, "xonsh", user=user, replace=True, prefix=prefix
|
|
|
|
)
|
2015-11-16 14:04:32 -08:00
|
|
|
|
2015-09-30 00:56:14 -04:00
|
|
|
|
2016-06-26 09:46:43 -04:00
|
|
|
def dirty_version():
|
|
|
|
"""
|
|
|
|
If install/sdist is run from a git directory (not a conda install), add
|
|
|
|
a devN suffix to reported version number and write a gitignored file
|
|
|
|
that holds the git hash of the current state of the repo to be queried
|
|
|
|
by ``xonfig``
|
|
|
|
"""
|
|
|
|
try:
|
2018-08-30 09:17:34 -05:00
|
|
|
_version = subprocess.check_output(["git", "describe", "--tags"])
|
2016-06-30 13:30:16 -04:00
|
|
|
except Exception:
|
2018-08-30 09:17:34 -05:00
|
|
|
print("failed to find git tags", file=sys.stderr)
|
2016-06-26 09:54:08 -04:00
|
|
|
return False
|
2018-08-30 09:17:34 -05:00
|
|
|
_version = _version.decode("ascii")
|
2016-06-26 11:45:55 -04:00
|
|
|
try:
|
2018-08-30 09:17:34 -05:00
|
|
|
_, N, sha = _version.strip().split("-")
|
2016-07-27 14:51:36 +08:00
|
|
|
except ValueError: # tag name may contain "-"
|
2018-08-30 09:17:34 -05:00
|
|
|
print("failed to parse git version", file=sys.stderr)
|
2016-06-26 11:45:55 -04:00
|
|
|
return False
|
2018-08-30 09:17:34 -05:00
|
|
|
sha = sha.strip("g")
|
2016-07-26 18:53:36 +08:00
|
|
|
replace_version(N)
|
2018-08-30 09:17:34 -05:00
|
|
|
_cmd = ["git", "show", "-s", "--format=%cd", "--date=local", sha]
|
2016-11-02 12:24:43 +08:00
|
|
|
try:
|
|
|
|
_date = subprocess.check_output(_cmd)
|
2018-08-30 09:17:34 -05:00
|
|
|
_date = _date.decode("ascii")
|
2016-11-02 12:24:43 +08:00
|
|
|
# remove weekday name for a shorter string
|
2018-08-30 09:17:34 -05:00
|
|
|
_date = " ".join(_date.split()[1:])
|
2016-11-02 12:24:43 +08:00
|
|
|
except:
|
2018-08-30 09:17:34 -05:00
|
|
|
_date = ""
|
|
|
|
print("failed to get commit date", file=sys.stderr)
|
|
|
|
with open("xonsh/dev.githash", "w") as f:
|
|
|
|
f.write("{}|{}".format(sha, _date))
|
|
|
|
print("wrote git version: " + sha, file=sys.stderr)
|
2016-06-26 09:54:08 -04:00
|
|
|
return True
|
|
|
|
|
2016-06-26 09:46:43 -04:00
|
|
|
|
2016-06-27 23:31:15 -04:00
|
|
|
ORIGINAL_VERSION_LINE = None
|
|
|
|
|
2016-07-18 11:30:57 +02:00
|
|
|
|
2016-07-26 18:53:36 +08:00
|
|
|
def replace_version(N):
|
2016-06-26 09:46:43 -04:00
|
|
|
"""Replace version in `__init__.py` with devN suffix"""
|
2016-06-27 23:31:15 -04:00
|
|
|
global ORIGINAL_VERSION_LINE
|
2018-08-30 09:17:34 -05:00
|
|
|
with open("xonsh/__init__.py", "r") as f:
|
2016-06-26 09:46:43 -04:00
|
|
|
raw = f.read()
|
|
|
|
lines = raw.splitlines()
|
2018-08-30 09:17:34 -05:00
|
|
|
msg_assert = "__version__ must be the first line of the __init__.py"
|
|
|
|
assert "__version__" in lines[0], msg_assert
|
2016-06-27 23:31:15 -04:00
|
|
|
ORIGINAL_VERSION_LINE = lines[0]
|
2018-08-30 09:25:36 -05:00
|
|
|
lines[0] = lines[0].rstrip(' "') + '.dev{}"'.format(N)
|
2018-08-30 09:17:34 -05:00
|
|
|
upd = "\n".join(lines) + "\n"
|
|
|
|
with open("xonsh/__init__.py", "w") as f:
|
2016-06-26 09:46:43 -04:00
|
|
|
f.write(upd)
|
|
|
|
|
|
|
|
|
2016-06-27 23:31:15 -04:00
|
|
|
def restore_version():
|
|
|
|
"""If we touch the version in __init__.py discard changes after install."""
|
2016-07-26 18:53:36 +08:00
|
|
|
if ORIGINAL_VERSION_LINE is None:
|
|
|
|
return
|
2018-08-30 09:17:34 -05:00
|
|
|
with open("xonsh/__init__.py", "r") as f:
|
2016-06-27 23:31:15 -04:00
|
|
|
raw = f.read()
|
|
|
|
lines = raw.splitlines()
|
|
|
|
lines[0] = ORIGINAL_VERSION_LINE
|
2018-08-30 09:17:34 -05:00
|
|
|
upd = "\n".join(lines) + "\n"
|
|
|
|
with open("xonsh/__init__.py", "w") as f:
|
2016-06-27 23:31:15 -04:00
|
|
|
f.write(upd)
|
2016-06-26 09:54:08 -04:00
|
|
|
|
|
|
|
|
2015-03-09 22:42:34 -05:00
|
|
|
class xinstall(install):
|
2015-11-16 15:06:57 -08:00
|
|
|
"""Xonsh specialization of setuptools install class."""
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2015-03-09 22:42:34 -05:00
|
|
|
def run(self):
|
|
|
|
clean_tables()
|
2016-07-23 20:48:34 +03:00
|
|
|
build_tables()
|
|
|
|
amalgamate_source()
|
2016-06-26 09:46:43 -04:00
|
|
|
# add dirty version number
|
2016-06-26 09:54:08 -04:00
|
|
|
dirty = dirty_version()
|
2016-05-22 17:51:42 -04:00
|
|
|
# install Jupyter hook
|
|
|
|
root = self.root if self.root else None
|
|
|
|
prefix = self.prefix if self.prefix else None
|
|
|
|
try:
|
|
|
|
install_jupyter_hook(prefix=prefix, root=root)
|
|
|
|
except Exception:
|
|
|
|
import traceback
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2016-05-22 17:51:42 -04:00
|
|
|
traceback.print_exc()
|
2018-08-30 09:17:34 -05:00
|
|
|
print("Installing Jupyter hook failed.")
|
2016-07-29 17:49:06 +02:00
|
|
|
super().run()
|
2016-06-26 09:54:08 -04:00
|
|
|
if dirty:
|
2016-06-27 23:31:15 -04:00
|
|
|
restore_version()
|
2016-06-26 09:54:08 -04:00
|
|
|
|
2015-03-09 22:42:34 -05:00
|
|
|
|
|
|
|
class xsdist(sdist):
|
2015-11-16 15:06:57 -08:00
|
|
|
"""Xonsh specialization of setuptools sdist class."""
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2015-03-09 22:42:34 -05:00
|
|
|
def make_release_tree(self, basedir, files):
|
|
|
|
clean_tables()
|
2016-07-23 20:48:34 +03:00
|
|
|
build_tables()
|
|
|
|
amalgamate_source()
|
2016-06-26 09:54:08 -04:00
|
|
|
dirty = dirty_version()
|
2016-07-29 17:49:06 +02:00
|
|
|
super().make_release_tree(basedir, files)
|
2016-06-26 09:54:08 -04:00
|
|
|
if dirty:
|
2016-06-27 23:31:15 -04:00
|
|
|
restore_version()
|
2015-09-30 00:56:14 -04:00
|
|
|
|
2016-06-26 09:46:43 -04:00
|
|
|
|
2016-05-13 22:13:09 +01:00
|
|
|
# Hack to overcome pip/setuptools problem on Win 10. See:
|
|
|
|
# https://github.com/tomduck/pandoc-eqnos/issues/6
|
|
|
|
# https://github.com/pypa/pip/issues/2783
|
|
|
|
|
|
|
|
# Custom install_scripts command class for setup()
|
|
|
|
class install_scripts_quoted_shebang(install_scripts):
|
|
|
|
"""Ensure there are quotes around shebang paths with spaces."""
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2016-05-13 22:13:09 +01:00
|
|
|
def write_script(self, script_name, contents, mode="t", *ignored):
|
|
|
|
shebang = str(contents.splitlines()[0])
|
2018-08-30 09:17:34 -05:00
|
|
|
if (
|
|
|
|
shebang.startswith("#!")
|
|
|
|
and " " in shebang[2:].strip()
|
|
|
|
and '"' not in shebang
|
|
|
|
):
|
2016-05-13 22:13:09 +01:00
|
|
|
quoted_shebang = '#!"%s"' % shebang[2:].strip()
|
|
|
|
contents = contents.replace(shebang, quoted_shebang)
|
|
|
|
super().write_script(script_name, contents, mode, *ignored)
|
|
|
|
|
2016-07-29 17:49:06 +02:00
|
|
|
|
|
|
|
class install_scripts_rewrite(install_scripts):
|
2016-07-30 20:38:18 +02:00
|
|
|
"""Change default python3 to the concrete python binary used to install/develop inside xon.sh script"""
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2016-07-29 17:49:06 +02:00
|
|
|
def run(self):
|
|
|
|
super().run()
|
2016-07-30 20:38:18 +02:00
|
|
|
if not self.dry_run:
|
2016-07-29 17:49:06 +02:00
|
|
|
for file in self.get_outputs():
|
2018-08-30 09:17:34 -05:00
|
|
|
if file.endswith("xon.sh"):
|
2016-07-30 20:38:18 +02:00
|
|
|
# this is the value distutils use on its shebang translation
|
2018-08-30 09:17:34 -05:00
|
|
|
bs_cmd = self.get_finalized_command("build_scripts")
|
|
|
|
exec_param = getattr(bs_cmd, "executable", None)
|
2016-07-29 17:49:06 +02:00
|
|
|
|
2018-08-30 09:17:34 -05:00
|
|
|
with open(file, "r") as f:
|
2016-07-29 17:49:06 +02:00
|
|
|
content = f.read()
|
|
|
|
|
2018-08-30 09:17:34 -05:00
|
|
|
processed = content.replace(
|
|
|
|
" python3 ", ' "{}" '.format(exec_param)
|
|
|
|
)
|
2016-07-29 17:49:06 +02:00
|
|
|
|
2018-08-30 09:17:34 -05:00
|
|
|
with open(file, "w") as f:
|
2016-07-29 17:49:06 +02:00
|
|
|
f.write(processed)
|
|
|
|
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2016-05-13 22:13:09 +01:00
|
|
|
# The custom install needs to be used on Windows machines
|
2018-08-30 09:17:34 -05:00
|
|
|
if os.name == "nt":
|
|
|
|
cmdclass = {
|
|
|
|
"install": xinstall,
|
|
|
|
"sdist": xsdist,
|
|
|
|
"install_scripts": install_scripts_quoted_shebang,
|
|
|
|
}
|
2016-05-13 22:13:09 +01:00
|
|
|
else:
|
2018-08-30 09:17:34 -05:00
|
|
|
cmdclass = {
|
|
|
|
"install": xinstall,
|
|
|
|
"sdist": xsdist,
|
|
|
|
"install_scripts": install_scripts_rewrite,
|
|
|
|
}
|
2016-05-13 22:13:09 +01:00
|
|
|
|
|
|
|
|
2015-04-06 23:21:03 -05:00
|
|
|
if HAVE_SETUPTOOLS:
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2015-04-06 23:21:03 -05:00
|
|
|
class xdevelop(develop):
|
2015-11-16 15:06:57 -08:00
|
|
|
"""Xonsh specialization of setuptools develop class."""
|
2018-08-30 09:17:34 -05:00
|
|
|
|
2015-04-06 23:21:03 -05:00
|
|
|
def run(self):
|
|
|
|
clean_tables()
|
2016-07-23 20:48:34 +03:00
|
|
|
build_tables()
|
2016-06-26 09:54:08 -04:00
|
|
|
dirty = dirty_version()
|
2015-04-06 23:57:38 -05:00
|
|
|
develop.run(self)
|
2016-06-26 09:54:08 -04:00
|
|
|
if dirty:
|
2016-06-27 23:31:15 -04:00
|
|
|
restore_version()
|
2015-04-06 23:21:03 -05:00
|
|
|
|
2016-07-29 17:49:06 +02:00
|
|
|
def install_script(self, dist, script_name, script_text, dev_path=None):
|
2018-08-30 09:17:34 -05:00
|
|
|
if script_name == "xon.sh":
|
2016-07-30 20:38:18 +02:00
|
|
|
# change default python3 to the concrete python binary used to install/develop inside xon.sh script
|
2018-08-30 09:17:34 -05:00
|
|
|
script_text = script_text.replace(
|
|
|
|
" python3 ", ' "{}" '.format(sys.executable)
|
|
|
|
)
|
2016-07-29 17:49:06 +02:00
|
|
|
super().install_script(dist, script_name, script_text, dev_path)
|
|
|
|
|
2015-04-06 23:21:03 -05:00
|
|
|
|
2015-03-07 12:02:04 -06:00
|
|
|
def main():
|
2015-11-16 15:06:57 -08:00
|
|
|
"""The main entry point."""
|
2015-03-23 01:40:44 -05:00
|
|
|
try:
|
2018-08-30 09:17:34 -05:00
|
|
|
if "--name" not in sys.argv:
|
|
|
|
logo_fname = os.path.join(os.path.dirname(__file__), "logo.txt")
|
|
|
|
with open(logo_fname, "rb") as f:
|
|
|
|
logo = f.read().decode("utf-8")
|
2015-08-07 22:39:22 +02:00
|
|
|
print(logo)
|
2015-03-23 01:40:44 -05:00
|
|
|
except UnicodeEncodeError:
|
|
|
|
pass
|
2018-08-30 09:17:34 -05: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()
|
2018-08-30 09:17:34 -05:00
|
|
|
scripts = ["scripts/xon.sh"]
|
|
|
|
if sys.platform == "win32":
|
|
|
|
scripts.append("scripts/xonsh.bat")
|
|
|
|
scripts.append("scripts/xonsh-cat.bat")
|
2016-06-16 10:35:26 -04:00
|
|
|
else:
|
2018-08-30 09:17:34 -05:00
|
|
|
scripts.append("scripts/xonsh")
|
|
|
|
scripts.append("scripts/xonsh-cat")
|
2015-03-07 12:09:30 -06:00
|
|
|
skw = dict(
|
2018-08-30 09:17:34 -05:00
|
|
|
name="xonsh",
|
|
|
|
description="Python-powered, cross-platform, Unix-gazing shell",
|
2015-03-07 12:09:30 -06:00
|
|
|
long_description=readme,
|
2018-08-30 09:17:34 -05:00
|
|
|
license="BSD",
|
2015-03-24 16:07:37 -04:00
|
|
|
version=XONSH_VERSION,
|
2018-08-30 09:17:34 -05:00
|
|
|
author="Anthony Scopatz",
|
|
|
|
maintainer="Anthony Scopatz",
|
|
|
|
author_email="scopatz@gmail.com",
|
|
|
|
url="https://github.com/xonsh/xonsh",
|
|
|
|
platforms="Cross Platform",
|
|
|
|
classifiers=["Programming Language :: Python :: 3"],
|
|
|
|
packages=[
|
|
|
|
"xonsh",
|
|
|
|
"xonsh.ply.ply",
|
|
|
|
"xonsh.ptk",
|
|
|
|
"xonsh.ptk2",
|
|
|
|
"xonsh.parsers",
|
|
|
|
"xonsh.xoreutils",
|
|
|
|
"xontrib",
|
|
|
|
"xonsh.completers",
|
|
|
|
"xonsh.history",
|
|
|
|
"xonsh.prompt",
|
|
|
|
"xonsh.lib",
|
|
|
|
],
|
|
|
|
package_dir={"xonsh": "xonsh", "xontrib": "xontrib", "xonsh.lib": "xonsh/lib"},
|
|
|
|
package_data={
|
|
|
|
"xonsh": ["*.json", "*.githash"],
|
|
|
|
"xontrib": ["*.xsh"],
|
|
|
|
"xonsh.lib": ["*.xsh"],
|
|
|
|
},
|
2016-06-16 10:35:26 -04:00
|
|
|
cmdclass=cmdclass,
|
|
|
|
scripts=scripts,
|
2018-08-30 09:17:34 -05:00
|
|
|
)
|
2015-03-09 22:42:34 -05:00
|
|
|
if HAVE_SETUPTOOLS:
|
2016-06-16 10:35:26 -04:00
|
|
|
# WARNING!!! Do not use setuptools 'console_scripts'
|
2017-06-07 11:51:17 -04:00
|
|
|
# It validates the dependencies (of which we have none) every time the
|
2016-06-16 10:35:26 -04:00
|
|
|
# 'xonsh' command is run. This validation adds ~0.2 sec. to the startup
|
|
|
|
# time of xonsh - for every single xonsh run. This prevents us from
|
|
|
|
# reaching the goal of a startup time of < 0.1 sec. So never ever write
|
|
|
|
# the following:
|
|
|
|
#
|
|
|
|
# 'console_scripts': ['xonsh = xonsh.main:main'],
|
|
|
|
#
|
|
|
|
# END WARNING
|
2018-08-30 09:17:34 -05:00
|
|
|
skw["entry_points"] = {
|
|
|
|
"pygments.lexers": [
|
|
|
|
"xonsh = xonsh.pyghooks:XonshLexer",
|
|
|
|
"xonshcon = xonsh.pyghooks:XonshConsoleLexer",
|
|
|
|
],
|
|
|
|
"pytest11": ["xonsh = xonsh.pytest_plugin"],
|
2016-08-18 21:49:44 +02:00
|
|
|
}
|
2018-08-30 09:17:34 -05:00
|
|
|
skw["cmdclass"]["develop"] = xdevelop
|
|
|
|
skw["extras_require"] = {
|
|
|
|
"ptk": ["prompt-toolkit"],
|
|
|
|
"pygments": ["pygments>=2.2"],
|
|
|
|
"mac": ["gnureadline"],
|
|
|
|
"linux": ["distro"],
|
|
|
|
"proctitle": ["setproctitle"],
|
2019-06-17 14:46:28 -04:00
|
|
|
"zipapp": ['importlib_resources; python_version < "3.7"'],
|
2016-09-29 22:40:37 -04:00
|
|
|
}
|
2019-05-14 17:41:35 -04:00
|
|
|
skw["python_requires"] = ">=3.5"
|
2015-03-07 12:02:04 -06:00
|
|
|
setup(**skw)
|
|
|
|
|
2015-03-07 17:32:13 -06:00
|
|
|
|
2018-08-30 09:17:34 -05:00
|
|
|
if __name__ == "__main__":
|
2015-03-07 12:02:04 -06:00
|
|
|
main()
|