forked from sunpy/sunpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpavement.py
More file actions
96 lines (83 loc) · 2.22 KB
/
Copy pathpavement.py
File metadata and controls
96 lines (83 loc) · 2.22 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
"""
SunPy: Python for Solar Physics
The SunPy project is an effort to create an open-source software library for
solar physics using the Python programming language.
"""
#pylint: disable=W0404,W0621
import os
import imp
import shutil
from paver.easy import *
from paver.setuputils import setup
# This is not pretty, but necessary
install = imp.load_source(
'setup', os.path.join(os.path.dirname(__file__), 'setup.py')).install
#
# Options
#
options(
deploy = Bunch(
htmldir = path('doc/source/_build/html'),
host = 'sipwork.org',
hostpath = 'www/sunpy/doc'
),
sphinx = Bunch(docroot='doc/source', builddir="_build"),
pylint = Bunch(quiet=False)
)
#
# Packaging
#
install(setup)
@task
@needs('prepare_docs', 'setuptools.command.sdist')
def sdist():
"""Generated HTML docs and builds a tarball."""
shutil.rmtree('doc/html')
#
# Documentation
#
@task
@needs('paver.doctools.html')
def prepare_docs():
"""Prepares the SunPy HTML documentation for packaging"""
sourcedir = 'doc/source/_build/html'
destdir = 'doc/html'
if os.path.exists(destdir):
shutil.rmtree(destdir)
shutil.move(sourcedir, destdir)
@task
@needs('paver.doctools.html')
@cmdopts([('username=', 'u', 'Username')])
def deploy(options):
"""Update the docs on sunpy.org"""
if "username" not in options:
options.username = raw_input("Username: ")
sh("rsync -avz -e ssh %s/ %s@%s:%s/" % (options.htmldir,
options.username, options.host, options.hostpath))
#
# PyLint
#
@task
@cmdopts([('quiet', 'q', 'Run PyLint in quiet mode')])
def pylint(options):
"""Checks the code using PyLint"""
from pylint import lint
arguments = ['--rcfile=tools/pylint/pylintrc']
if options.quiet:
arguments.extend(["-rn"])
arguments.extend(["sunpy/", "tests/"])
lint.Run(arguments)
#
# Cleanup
#
@task
@needs('paver.doctools.doc_clean')
def clean():
"""Cleans up build files"""
print("Removing build files")
for dir_ in ['doc/html', 'doc/source/_build', 'build', 'dist', 'sunpy.egg-info']:
if os.path.exists(dir_):
shutil.rmtree(dir_)
for file_ in ['MANIFEST']:
if os.path.exists(file_):
os.remove(file_)