forked from muggenhor/noweb.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
74 lines (62 loc) · 2.14 KB
/
setup.py
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
#!/usr/bin/env python
# -*- coding: utf8 -*-
from setuptools import setup, find_packages
from distutils.command.build import build
import tempfile
import bootstrap
import shutil
import os
class CustomBuild(build):
def run(self):
tmpdir = None
try:
# Create a temporary working directory
tmpdir = tempfile.mkdtemp()
# Create tmp script
tmp_noweb = os.path.join(tmpdir, "noweb.py")
# Tangle
chunks = bootstrap.read("noweb.py.nw", "utf-8")
lines = bootstrap.tangle("noweb.py", chunks, "")
bootstrap.write(lines, "noweb.py", tmp_noweb, "utf-8")
# And tangle again
tangle_spell = "python " + tmp_noweb + " -o noweb.py tangle -R noweb.py noweb.py.nw"
os.system(tangle_spell)
# Weave
os.system("python noweb.py -o README.md weave --default-code-syntax=python noweb.py.nw")
finally:
# Clean up our temporary working directory
if tmpdir:
shutil.rmtree(tmpdir, ignore_errors=True)
build.run(self)
if __name__ == '__main__':
setup(
name='noweb.py',
version='0.0.1',
description="Literate programming tool",
long_description=__doc__,
author='Javier Escalada Gómez',
author_email='[email protected]',
url='http://github.com/Kerrigan29a/noweb.py',
packages=find_packages(),
include_package_data=True,
install_requires=[
],
scripts=[
'./noweb.py'
],
license='BSD 3 Clause',
cmdclass={
"build": CustomBuild,
},
keywords="literate programming",
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Topic :: Utilities",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development :: Documentation",
"Topic :: Software Development :: Pre-processors",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
],
)