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
c9d818ca
Commit
c9d818ca
authored
Jan 18, 2008
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added win_add2path.py to Tools/scripts/
Added builddoc.bat to Doc/
parent
dd505810
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
0 deletions
+113
-0
Doc/builddoc.bat
Doc/builddoc.bat
+52
-0
Misc/NEWS
Misc/NEWS
+4
-0
Tools/scripts/win_add2path.py
Tools/scripts/win_add2path.py
+57
-0
No files found.
Doc/builddoc.bat
0 → 100644
View file @
c9d818ca
@echo
off
setlocal
set
SVNROOT
=
http
://svn.python.org/projects
if
"
%PYTHON%
"
EQU
""
set
PYTHON
=
python25
if
"
%
1"
EQU
""
goto
help
if
"
%
1"
EQU
"html"
goto
build
if
"
%
1"
EQU
"htmlhelp"
goto
build
if
"
%
1"
EQU
"web"
goto
build
if
"
%
1"
EQU
"webrun"
goto
webrun
if
"
%
1"
EQU
"checkout"
goto
checkout
if
"
%
1"
EQU
"update"
goto
update
:help
echo
HELP
echo
.
echo
builddoc
checkout
echo
builddoc
update
echo
builddoc
html
echo
builddoc
htmlhelp
echo
builddoc
web
echo
builddoc
webrun
echo
.
goto
end
:checkout
svn
co
%SVNROOT%
/doctools/trunk/sphinx
tools
/sphinx
svn
co
%SVNROOT%
/external/docutils
-
0
.4/docutils
tools
/docutils
svn
co
%SVNROOT%
/external/Pygments
-
0
.9/pygments
tools
/pygments
goto
end
:update
svn
update
tools
/sphinx
svn
update
tools
/docutils
svn
update
tools
/pygments
goto
end
:build
if
not
exist
build
mkdir
build
if
not
exist
build
\
%
1
mkdir
build
\
%
1
if
not
exist
build
\doctrees
mkdir
build
\doctrees
cmd
/C
%PYTHON%
tools
\sphinx
-build
.py
-b
%
1
-dbuild
\doctrees .
build
\
%
1
if
"
%
1"
EQU
"htmlhelp"
"
%ProgramFiles%
\HTML Help Workshop\hhc.exe"
build
\htmlhelp\pydoc.hhp
goto
end
:webrun
set
PYTHONPATH
=
tools
%PYTHON%
-m
sphinx
.web
build
\web
goto
end
:end
Misc/NEWS
View file @
c9d818ca
...
...
@@ -1196,6 +1196,10 @@ Tests
Tools
-----
-
Tools
/
scripts
/
win_add2path
.
py
was
added
.
The
simple
script
modifes
the
PATH
environment
var
of
the
HKCU
tree
and
adds
the
python
bin
and
script
directory
.
-
Tools
/
18
n
/
pygettext
.
py
was
added
to
the
list
of
scripts
installed
by
Tools
/
scripts
/
setup
.
py
(
tracker
item
642309
).
...
...
Tools/scripts/win_add2path.py
0 → 100644
View file @
c9d818ca
"""Add Python to the search path on Windows
This is a simple script to add Python to the Windows search path. It
modifies the current user (HKCU) tree of the registry.
Copyright (c) 2008 by Christian Heimes <christian@cheimes.de>
Licensed to PSF under a Contributor Agreement.
"""
import
sys
import
site
import
os
import
_winreg
HKCU
=
_winreg
.
HKEY_CURRENT_USER
ENV
=
"Environment"
PATH
=
"PATH"
DEFAULT
=
u"%PATH%"
def
modify
():
pythonpath
=
os
.
path
.
dirname
(
os
.
path
.
normpath
(
sys
.
executable
))
scripts
=
os
.
path
.
join
(
pythonpath
,
"Scripts"
)
appdata
=
os
.
environ
[
"APPDATA"
]
if
hasattr
(
site
,
"USER_SITE"
):
userpath
=
site
.
USER_SITE
.
replace
(
appdata
,
"%APPDATA%"
)
userscripts
=
os
.
path
.
join
(
userpath
,
"Scripts"
)
else
:
userscripts
=
None
with
_winreg
.
CreateKey
(
HKCU
,
ENV
)
as
key
:
try
:
envpath
=
_winreg
.
QueryValueEx
(
key
,
PATH
)[
0
]
except
WindowsError
:
envpath
=
DEFAULT
paths
=
[
envpath
]
for
path
in
(
pythonpath
,
scripts
,
userscripts
):
if
path
and
path
not
in
envpath
and
os
.
path
.
isdir
(
path
):
paths
.
append
(
path
)
envpath
=
os
.
pathsep
.
join
(
paths
)
_winreg
.
SetValueEx
(
key
,
PATH
,
0
,
_winreg
.
REG_EXPAND_SZ
,
envpath
)
return
paths
,
envpath
def
main
():
paths
,
envpath
=
modify
()
if
len
(
paths
)
>
1
:
print
"Path(s) added:"
print
'
\
n
'
.
join
(
paths
[
1
:])
else
:
print
"No path was added"
print
"
\
n
PATH is now:
\
n
%s
\
n
"
%
envpath
print
"Expanded:"
print
_winreg
.
ExpandEnvironmentStrings
(
envpath
)
if
__name__
==
'__main__'
:
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