forked from brython-dev/brython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
101 lines (75 loc) · 2.79 KB
/
setup.py
File metadata and controls
101 lines (75 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
import os
import shutil
import sys
with open('README.rst', encoding='utf-8') as fobj:
LONG_DESCRIPTION = fobj.read()
command = sys.argv[1]
if command == "sdist":
# before creating the distribution, copy files from other locations in
# the repository
print("copying files...")
this_dir = os.getcwd()
root_dir = os.path.dirname(this_dir)
src_dir = os.path.join(root_dir, "www", "src")
data_dir = os.path.join(this_dir, "data")
# copy files from /www/src
for fname in ["brython.js", "brython_stdlib.js", "unicode.txt"]:
shutil.copyfile(os.path.join(src_dir, fname),
os.path.join(data_dir, fname))
# copy demo.html
with open(os.path.join(root_dir, 'www', 'demo.html'), encoding="utf-8") as f:
demo = f.read()
start_tag = "<!-- start copy -->"
end_tag = "<!-- end copy -->"
start = demo.find(start_tag)
if start == -1:
raise Exception("No tag <!-- start copy --> in demo.html")
end = demo.find(end_tag)
if end == -1:
raise Exception("No tag <!-- end copy --> in demo.html")
body = demo[start + len(start_tag) : end].strip()
with open(os.path.join(data_dir, "demo.tmpl"), encoding="utf-8") as f:
template = f.read()
demo = template.replace("{{body}}", body)
with open(os.path.join(data_dir, "demo.html"), "w", encoding="utf-8") as out:
out.write(demo)
setup(
name='brython',
version='3.7.0rc1',
description='Brython is an implementation of Python 3 running in the browser',
long_description=LONG_DESCRIPTION,
# The project's main homepage.
url='http://brython.info',
# Author details
author='Pierre Quentel',
author_email='quentel.pierre@orange.fr',
packages = ['data', 'data.tools'],
# Choose your license
license='BSD',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Interpreters',
'Operating System :: OS Independent',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: BSD License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 3',
],
# What does your project relate to?
keywords='Python browser',
py_modules=["brython", "list_modules", "server"],
package_data={
'data': [
'README.txt',
'demo.html',
'brython.js',
'brython_stdlib.js',
'unicode.txt'
]
}
)