from __future__ import absolute_import
import os
from os.path import join
from setuptools import findall
path = os.path.dirname(os.path.realpath(__file__))
TEMPLATES = join("smc_pyutil", "templates")
os.system("chmod a+r -R %s" % join(path, TEMPLATES))
template_files = findall(TEMPLATES)
template_data = [(f.split(TEMPLATES)[1], [f]) for f in template_files]
def readme():
with open('README.md') as f:
return f.read()
import fastentrypoints
from setuptools import setup, find_packages
from distutils.core import Distribution
d = Distribution()
d.parse_command_line()
python3_nosite = '/usr/local/bin/python3-nosite'
if 'user' not in list(d.command_options.get("install", {}).keys()):
if os.path.isfile(python3_nosite) and os.access(python3_nosite, os.X_OK):
import sys
sys.executable = python3_nosite
cs = [
'open = smc_pyutil.smc_open:main',
'close = smc_pyutil.smc_close:main',
]
for prefix in ['smc', 'cc', 'cocalc']:
add = cs.append
add('%s-sagews2pdf = smc_pyutil.sagews2pdf:main' % prefix)
add('%s-sws2sagews = smc_pyutil.sws2sagews:main' % prefix)
add('%s-open = smc_pyutil.smc_open:main' % prefix)
add('%s-new-file = smc_pyutil.new_file:main' % prefix)
add('%s-status = smc_pyutil.status:main' % prefix)
add('%s-jupyter-no-output= smc_pyutil.jupyter_delete_output:main' % prefix)
add('%s-ipynb2sagews = smc_pyutil.ipynb2sagews:main' % prefix)
add('%s-start = smc_pyutil.start_smc:main' % prefix)
add('%s-stop = smc_pyutil.stop_smc:main' % prefix)
add('%s-html2sagews = smc_pyutil.html2sagews:main' % prefix)
add('%s-sagews2ipynb = smc_pyutil.sagews2ipynb:main' % prefix)
if prefix != 'smc':
add('%s-first-steps = smc_pyutil.first_steps:main' % prefix)
add('%s-ipynb-to-pdf = smc_pyutil.ipynb_to_pdf:main' % prefix)
add('%s-close = smc_pyutil.smc_close:main' % prefix)
add('%s-jupyter-classic-open = smc_pyutil.jupyter_notebook:prepare_file_for_open'
% prefix)
setup(
name='smc_pyutil',
version='1.2',
description='CoCalc Python Utilities',
long_description=readme(),
url='https://github.com/sagemathinc/cocalc',
author='SageMath, Inc.',
author_email='[email protected]',
license='GPLv3+',
packages=find_packages(),
install_requires=['markdown2', 'psutil', 'PyYAML', 'ansi2html'],
zip_safe=False,
classifiers=[
'License :: OSI Approved :: GPLv3',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Topic :: Mathematics :: Server',
],
keywords='server mathematics cloud',
scripts=[
'smc_pyutil/bin/smc-sage-server', 'smc_pyutil/bin/cocalc-python3-clean'
],
entry_points={'console_scripts': cs},
include_package_data=True,
package_data={'smc_pyutil': ['smc_pyutil/templates/*']},
data_files=template_data,
)