Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 39530
1
###
2
# To do development on this, install it locally:
3
# pip install --user --upgrade smc_pyutil/
4
###
5
6
# CRITICAL: I don't know any other way to ensure the permissions are
7
# right on the templates than this
8
import os
9
from os.path import join
10
path = os.path.dirname(os.path.realpath(__file__))
11
os.system("chmod a+r -R %s"%join(path, "smc_pyutil", "templates"))
12
13
def readme():
14
with open('README.md') as f:
15
return f.read()
16
17
# from https://github.com/ninjaaron/fast-entry_points/ issue https://github.com/sagemathinc/cocalc/issues/2259
18
import fastentrypoints
19
from setuptools import setup, find_packages
20
21
# This checks, if setup.py is run with 'install --user'
22
# in that case we assume it is installed for development and do NOT change the python executable.
23
# Therefore we want to load the local library via the site.py mechanism.
24
# (this mimics http://svn.python.org/projects/python/trunk/Lib/distutils/dist.py, called in setup behind the scenes)
25
from distutils.core import Distribution
26
d = Distribution()
27
d.parse_command_line()
28
29
# CRITICAL!
30
# Uses a wrapped python executable to not load the user's "site" packages in ~/.local.
31
# Otherwise, setuptool's startup scripts do not work, if there is a conflicting
32
# setuptools version in .local/lib/python-packages (or, any other locally installed python lib)
33
# setting sys.executable changes the she-bang #!... at the top of these scripts
34
# credits to http://stackoverflow.com/a/17329493
35
python2_nosite = '/usr/local/bin/python2-nosite'
36
# don't overwrite for local smc-in-smc development
37
if 'user' not in d.command_options.get("install", {}).keys():
38
# check, if python2_nosite exists and is executable
39
if os.path.isfile(python2_nosite) and os.access(python2_nosite, os.X_OK):
40
import sys
41
sys.executable = python2_nosite
42
43
setup(
44
name = 'smc_pyutil',
45
version = '1.1',
46
description = 'CoCalc Python Utilities',
47
long_description = readme(),
48
url = 'https://github.com/sagemathinc/cocalc',
49
author = 'SageMath, Inc.',
50
author_email = '[email protected]',
51
license = 'GPLv3+',
52
packages = find_packages(),
53
install_requires = ['markdown2', 'psutil', 'PyYAML', 'ansi2html'],
54
zip_safe = False,
55
classifiers = [
56
'License :: OSI Approved :: GPLv3',
57
'Programming Language :: Python :: 2.7',
58
'Topic :: Mathematics :: Server',
59
],
60
keywords = 'server mathematics cloud',
61
scripts = ['smc_pyutil/bin/smc-sage-server'],
62
entry_points = {
63
'console_scripts': [
64
'open = smc_pyutil.smc_open:main',
65
# START deprecated smc-*
66
'smc-sagews2pdf = smc_pyutil.sagews2pdf:main',
67
'smc-sws2sagews = smc_pyutil.sws2sagews:main',
68
'smc-docx2txt = smc_pyutil.docx2txt:main',
69
'smc-open = smc_pyutil.smc_open:main',
70
'smc-new-file = smc_pyutil.new_file:main',
71
'smc-status = smc_pyutil.status:main',
72
'smc-jupyter = smc_pyutil.jupyter_notebook:main',
73
'smc-jupyter-no-output= smc_pyutil.jupyter_delete_output:main',
74
'smc-ipynb2sagews = smc_pyutil.ipynb2sagews:main',
75
'smc-ls = smc_pyutil.git_ls:main',
76
'smc-compute = smc_pyutil.smc_compute:main',
77
'smc-start = smc_pyutil.start_smc:main',
78
'smc-stop = smc_pyutil.stop_smc:main',
79
'smc-update-snapshots = smc_pyutil.update_snapshots:update_snapshots',
80
'smc-top = smc_pyutil.smc_top:main',
81
'smc-git = smc_pyutil.smc_git:main',
82
'smc-html2sagews = smc_pyutil.html2sagews:main',
83
'smc-rmd2html = smc_pyutil.rmd2html:main',
84
'smc-java2html = smc_pyutil.java2html:main',
85
'smc-m2sagews = smc_pyutil.m2sagews:main',
86
'smc-sagews2ipynb = smc_pyutil.sagews2ipynb:main',
87
# END deprecated smc-*
88
'cc-sagews2pdf = smc_pyutil.sagews2pdf:main',
89
'cc-sws2sagews = smc_pyutil.sws2sagews:main',
90
'cc-docx2txt = smc_pyutil.docx2txt:main',
91
'cc-open = smc_pyutil.smc_open:main',
92
'cc-new-file = smc_pyutil.new_file:main',
93
'cc-status = smc_pyutil.status:main',
94
'cc-jupyter = smc_pyutil.jupyter_notebook:main',
95
'cc-jupyter-no-output= smc_pyutil.jupyter_delete_output:main',
96
'cc-jupyter-classic-open = smc_pyutil.jupyter_notebook:prepare_file_for_open',
97
'cc-ipynb2sagews = smc_pyutil.ipynb2sagews:main',
98
'cc-ls = smc_pyutil.git_ls:main',
99
'cc-compute = smc_pyutil.smc_compute:main',
100
'cc-start = smc_pyutil.start_smc:main',
101
'cc-stop = smc_pyutil.stop_smc:main',
102
'cc-update-snapshots = smc_pyutil.update_snapshots:update_snapshots',
103
'cc-top = smc_pyutil.smc_top:main',
104
'cc-git = smc_pyutil.smc_git:main',
105
'cc-html2sagews = smc_pyutil.html2sagews:main',
106
'cc-rmd2html = smc_pyutil.rmd2html:main',
107
'cc-java2html = smc_pyutil.java2html:main',
108
'cc-m2sagews = smc_pyutil.m2sagews:main',
109
'cc-sagews2ipynb = smc_pyutil.sagews2ipynb:main'
110
]
111
},
112
include_package_data = True
113
)
114
115