Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d2c684f7
Commit
d2c684f7
authored
Feb 14, 2003
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved setupDocs.py to Doc/setup.py and did some cleanup. It now at least
allows bdist, but it's still one big hack:-(
parent
71fcda5b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
49 deletions
+61
-49
Mac/OSX/Doc/setup.py
Mac/OSX/Doc/setup.py
+61
-49
No files found.
Mac/OSX/
setupDocs
.py
→
Mac/OSX/
Doc/setup
.py
View file @
d2c684f7
...
@@ -23,46 +23,47 @@ from distutils.dir_util import copy_tree
...
@@ -23,46 +23,47 @@ from distutils.dir_util import copy_tree
from
distutils.log
import
log
from
distutils.log
import
log
from
distutils.spawn
import
spawn
from
distutils.spawn
import
spawn
from
distutils
import
sysconfig
,
dep_util
from
distutils
import
sysconfig
,
dep_util
from
distutils.util
import
change_root
def
visit
(
arg
,
d
,
l
):
for
f
in
l
:
arg
.
hackFile
(
d
,
f
)
class
DocBuild
(
build
):
class
DocBuild
(
build
):
def
initialize_options
(
self
):
def
initialize_options
(
self
):
build
.
initialize_options
(
self
)
build
.
initialize_options
(
self
)
self
.
doc_dir
=
None
self
.
build_html
=
None
self
.
base_dir
=
None
self
.
build_dest
=
None
self
.
build_dir
=
None
self
.
download
=
1
self
.
download
=
1
self
.
doc_version
=
'2.2.1'
self
.
doc_version
=
'2.2.1'
def
finalize_options
(
self
):
def
finalize_options
(
self
):
build
.
finalize_options
(
self
)
build
.
finalize_options
(
self
)
if
self
.
build_dir
is
None
:
if
self
.
build_html
is
None
:
self
.
build_dir
=
self
.
build_temp
self
.
build_html
=
os
.
path
.
join
(
self
.
build_base
,
'html'
)
if
self
.
doc_dir
is
None
:
if
self
.
build_dest
is
None
:
self
.
doc_dir
=
data_info
=
self
.
distribution
.
data_files
[
0
][
1
][
0
]
self
.
build_dest
=
os
.
path
.
join
(
self
.
build_base
,
'processed-html'
)
self
.
build_dest
=
os
.
path
.
abspath
(
os
.
path
.
join
(
self
.
build_dir
,
self
.
doc_dir
))
#print 'DocBuild.finalize_options:\n build_dest = %s,\n doc_dir = %s' % (self.build_dest, self.doc_dir)
def
spawn
(
self
,
*
args
):
def
spawn
(
self
,
*
args
):
spawn
(
args
,
1
,
self
.
verbose
,
self
.
dry_run
)
spawn
(
args
,
1
,
self
.
verbose
,
self
.
dry_run
)
def
downloadDocs
(
self
):
def
downloadDocs
(
self
):
workdir
=
os
.
getcwd
()
workdir
=
os
.
getcwd
()
self
.
mkpath
(
self
.
build_html
)
os
.
chdir
(
self
.
build_base
)
self
.
spawn
(
'curl'
,
'-O'
,
'http://www.python.org/ftp/python/doc/%s/html-%s.tgz'
%
(
self
.
doc_version
,
self
.
doc_version
))
self
.
spawn
(
'curl'
,
'-O'
,
'http://www.python.org/ftp/python/doc/%s/html-%s.tgz'
%
(
self
.
doc_version
,
self
.
doc_version
))
self
.
mkpath
(
self
.
doc_
dir
)
os
.
chdir
(
work
dir
)
os
.
chdir
(
self
.
doc_dir
)
os
.
chdir
(
self
.
build_html
)
self
.
spawn
(
'tar'
,
'-xzf'
,
'../html-%s.tgz'
%
self
.
doc_version
)
self
.
spawn
(
'tar'
,
'-xzf'
,
'../html-%s.tgz'
%
self
.
doc_version
)
os
.
chdir
(
workdir
)
;
os
.
chdir
(
workdir
)
def
buildDocsFromSource
(
self
):
def
buildDocsFromSource
(
self
):
spawn
((
'make'
,
'--directory'
,
'../../Doc'
,
'html'
),
1
,
self
.
verbose
,
self
.
dry_run
)
srcdir
=
'../../..'
copy_tree
(
'../../Doc/html'
,
self
.
doc_dir
)
docdir
=
os
.
path
.
join
(
srcdir
,
'Doc'
)
htmldir
=
os
.
path
.
join
(
docdir
,
'html'
)
spawn
((
'make'
,
'--directory'
,
docdir
,
'html'
),
1
,
self
.
verbose
,
self
.
dry_run
)
self
.
mkpath
(
self
.
build_html
)
copy_tree
(
htmldir
,
self
.
build_html
)
def
ensureHtml
(
self
):
def
ensureHtml
(
self
):
if
not
os
.
path
.
exists
(
self
.
doc_dir
):
if
not
os
.
path
.
exists
(
self
.
build_html
):
if
self
.
download
:
if
self
.
download
:
self
.
downloadDocs
()
self
.
downloadDocs
()
else
:
else
:
...
@@ -72,13 +73,14 @@ class DocBuild(build):
...
@@ -72,13 +73,14 @@ class DocBuild(build):
ind_html
=
'index.html'
ind_html
=
'index.html'
#print 'self.build_dest =', self.build_dest
#print 'self.build_dest =', self.build_dest
hackedIndex
=
file
(
os
.
path
.
join
(
self
.
build_dest
,
ind_html
),
'w'
)
hackedIndex
=
file
(
os
.
path
.
join
(
self
.
build_dest
,
ind_html
),
'w'
)
origIndex
=
file
(
os
.
path
.
join
(
self
.
doc_dir
,
ind_html
))
origIndex
=
file
(
os
.
path
.
join
(
self
.
build_html
,
ind_html
))
r
=
re
.
compile
(
'<style type="text/css">.*</style>'
,
re
.
DOTALL
)
r
=
re
.
compile
(
'<style type="text/css">.*</style>'
,
re
.
DOTALL
)
hackedIndex
.
write
(
r
.
sub
(
'<META NAME="AppleTitle" CONTENT="Python Help">'
,
origIndex
.
read
()))
hackedIndex
.
write
(
r
.
sub
(
'<META NAME="AppleTitle" CONTENT="Python Help">'
,
origIndex
.
read
()))
def
hackFile
(
self
,
d
,
f
):
def
hackFile
(
self
,
d
,
f
):
origPath
=
os
.
path
.
join
(
d
,
f
)
origPath
=
os
.
path
.
join
(
d
,
f
)
outPath
=
os
.
path
.
join
(
self
.
build_dir
,
d
,
f
)
assert
(
origPath
[:
len
(
self
.
build_html
)]
==
self
.
build_html
)
outPath
=
os
.
path
.
join
(
self
.
build_dest
,
d
[
len
(
self
.
build_html
)
+
1
:],
f
)
(
name
,
ext
)
=
os
.
path
.
splitext
(
f
)
(
name
,
ext
)
=
os
.
path
.
splitext
(
f
)
if
os
.
path
.
isdir
(
origPath
):
if
os
.
path
.
isdir
(
origPath
):
self
.
mkpath
(
outPath
)
self
.
mkpath
(
outPath
)
...
@@ -92,7 +94,11 @@ class DocBuild(build):
...
@@ -92,7 +94,11 @@ class DocBuild(build):
def
hackHtml
(
self
):
def
hackHtml
(
self
):
self
.
r
=
re
.
compile
(
'<dl><dd>'
)
self
.
r
=
re
.
compile
(
'<dl><dd>'
)
os
.
path
.
walk
(
self
.
doc_dir
,
visit
,
self
)
os
.
path
.
walk
(
self
.
build_html
,
self
.
visit
,
None
)
def
visit
(
self
,
dummy
,
dirname
,
filenames
):
for
f
in
filenames
:
self
.
hackFile
(
dirname
,
f
)
def
makeHelpIndex
(
self
):
def
makeHelpIndex
(
self
):
app
=
'/Developer/Applications/Apple Help Indexing Tool.app'
app
=
'/Developer/Applications/Apple Help Indexing Tool.app'
...
@@ -102,45 +108,52 @@ class DocBuild(build):
...
@@ -102,45 +108,52 @@ class DocBuild(build):
def
run
(
self
):
def
run
(
self
):
self
.
ensure_finalized
()
self
.
ensure_finalized
()
self
.
ensureHtml
()
self
.
ensureHtml
()
data_info
=
self
.
distribution
.
data_files
[
0
][
1
]
if
not
os
.
path
.
isdir
(
self
.
build_html
):
if
not
os
.
path
.
isdir
(
self
.
doc_dir
):
raise
RuntimeError
,
\
raise
RuntimeError
,
\
"Can't find source folder for documentation."
"Can't find source folder for documentation."
if
dep_util
.
newer
(
os
.
path
.
join
(
self
.
doc_dir
,
'index.html'
),
os
.
path
.
join
(
self
.
build_dest
,
'index.html'
)):
self
.
mkpath
(
self
.
build_dest
)
if
dep_util
.
newer
(
os
.
path
.
join
(
self
.
build_html
,
'index.html'
),
os
.
path
.
join
(
self
.
build_dest
,
'index.html'
)):
self
.
mkpath
(
self
.
build_dest
)
self
.
mkpath
(
self
.
build_dest
)
self
.
hackHtml
()
self
.
hackHtml
()
self
.
hackIndex
()
self
.
hackIndex
()
self
.
makeHelpIndex
()
self
.
makeHelpIndex
()
class
DirInstall
(
Command
):
class
AHVDocInstall
(
Command
):
description
=
"install Apple Help Viewer html files"
user_options
=
[(
'install-doc='
,
'd'
,
'directory to install HTML tree'
),
(
'root='
,
None
,
"install everything relative to this alternate root directory"
),
]
def
initialize_options
(
self
):
def
initialize_options
(
self
):
self
.
build_dest
=
None
self
.
build_dest
=
None
self
.
install_dir
=
None
self
.
install_doc
=
None
self
.
prefix
=
None
self
.
root
=
None
def
finalize_options
(
self
):
def
finalize_options
(
self
):
self
.
set_undefined_options
(
'install'
,
(
'prefix'
,
'prefix'
),
(
'root'
,
'root'
))
# import pdb ; pdb.set_trace()
build_cmd
=
self
.
get_finalized_command
(
'build'
)
build_cmd
=
self
.
get_finalized_command
(
'build'
)
if
self
.
build_dest
==
None
:
if
self
.
build_dest
==
None
:
build_cmd
=
self
.
get_finalized_command
(
'build'
)
self
.
build_dest
=
build_cmd
.
build_dest
self
.
build_dest
=
build_cmd
.
build_dest
if
self
.
install_d
ir
==
None
:
if
self
.
install_d
oc
==
None
:
self
.
install_d
ir
=
self
.
distribution
.
data_files
[
0
][
0
]
self
.
install_d
oc
=
os
.
path
.
join
(
self
.
prefix
,
'Resources/English.lproj/Documentation'
)
print
self
.
build_dest
,
self
.
install_dir
print
'INSTALL'
,
self
.
build_dest
,
'->'
,
self
.
install_doc
def
run
(
self
):
def
run
(
self
):
self
.
finalize_options
()
self
.
finalize_options
()
self
.
ensure_finalized
()
self
.
ensure_finalized
()
print
"Running Installer"
print
"Running Installer"
data_info
=
self
.
distribution
.
data_files
[
0
][
1
]
instloc
=
self
.
install_doc
# spawn('pax','-r', '-w', base_dir,
if
self
.
root
:
print
self
.
__dict__
instloc
=
change_root
(
self
.
root
,
instloc
)
self
.
mkpath
(
self
.
install_dir
)
self
.
mkpath
(
instloc
)
# The Python way
copy_tree
(
self
.
build_dest
,
instloc
)
copy_tree
(
self
.
build_dest
,
self
.
install_dir
)
# The fast way
#workdir=os.getcwd()
#os.chdir(self.build_dest)
#self.spawn = ('pax', '-r', '-w', '.', self.install_dir)
#selfspawn(cmd, 1, self.verbose, self.dry_run);
#os.chdir(workdir)
print
"Installation complete"
print
"Installation complete"
def
mungeVersion
(
infile
,
outfile
):
def
mungeVersion
(
infile
,
outfile
):
...
@@ -152,13 +165,12 @@ def mungeVersion(infile, outfile):
...
@@ -152,13 +165,12 @@ def mungeVersion(infile, outfile):
def main():
def main():
# turn off warnings when deprecated modules are imported
# turn off warnings when deprecated modules are imported
import warnings
##
import warnings
warnings.filterwarnings("ignore",category=DeprecationWarning)
##
warnings.filterwarnings("ignore",category=DeprecationWarning)
setup(name = '
Python
Documentation
',
setup(name = '
Documentation
',
version = '
%
d
.
%
d
' % sys.version_info[:2],
version = '
%
d
.
%
d
' % sys.version_info[:2],
cmdclass = {'
install_data
':DirInstall, '
build
':DocBuild},
cmdclass = {'
install_data
':AHVDocInstall, '
build
':DocBuild},
# Data to install
data_files = ['
dummy
'],
data_files = [(sys.prefix+'
/
Resources
/
English
.
lproj
/
Documentation
',['
build
-
html
'])]
)
)
if __name__ == '
__main__
':
if __name__ == '
__main__
':
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment