Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
3bd7aa02
Commit
3bd7aa02
authored
Dec 21, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
massive import cleaning in Distutils
parent
6d2d1caa
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
97 additions
and
121 deletions
+97
-121
bcppcompiler.py
bcppcompiler.py
+4
-6
ccompiler.py
ccompiler.py
+21
-19
command/bdist.py
command/bdist.py
+3
-3
command/bdist_msi.py
command/bdist_msi.py
+0
-2
command/bdist_rpm.py
command/bdist_rpm.py
+8
-7
command/bdist_wininst.py
command/bdist_wininst.py
+6
-3
command/build_clib.py
command/build_clib.py
+1
-1
command/build_ext.py
command/build_ext.py
+2
-1
command/build_py.py
command/build_py.py
+0
-1
command/config.py
command/config.py
+2
-1
command/register.py
command/register.py
+3
-2
command/sdist.py
command/sdist.py
+5
-4
command/upload.py
command/upload.py
+1
-3
config.py
config.py
+0
-3
core.py
core.py
+7
-10
cygwinccompiler.py
cygwinccompiler.py
+0
-2
dir_util.py
dir_util.py
+1
-1
dist.py
dist.py
+2
-1
emxccompiler.py
emxccompiler.py
+0
-2
extension.py
extension.py
+0
-1
fancy_getopt.py
fancy_getopt.py
+8
-24
msvc9compiler.py
msvc9compiler.py
+3
-4
msvccompiler.py
msvccompiler.py
+8
-7
text_file.py
text_file.py
+12
-13
No files found.
bcppcompiler.py
View file @
3bd7aa02
...
...
@@ -13,13 +13,11 @@ for the Borland C++ compiler.
__revision__
=
"$Id$"
import
os
from
distutils.errors
import
\
DistutilsExecError
,
DistutilsPlatformError
,
\
CompileError
,
LibError
,
LinkError
,
UnknownFileError
from
distutils.ccompiler
import
\
CCompiler
,
gen_preprocess_options
,
gen_lib_options
from
distutils.errors
import
(
DistutilsExecError
,
CompileError
,
LibError
,
LinkError
,
UnknownFileError
)
from
distutils.ccompiler
import
CCompiler
,
gen_preprocess_options
from
distutils.file_util
import
write_file
from
distutils.dep_util
import
newer
from
distutils
import
log
...
...
ccompiler.py
View file @
3bd7aa02
...
...
@@ -5,9 +5,11 @@ for the Distutils compiler abstraction model."""
__revision__
=
"$Id$"
import
sys
,
os
,
re
from
types
import
*
from
distutils.errors
import
*
import
sys
import
os
import
re
from
distutils.errors
import
CompileError
,
LinkError
,
UnknownFileError
from
distutils.spawn
import
spawn
from
distutils.file_util
import
move_file
from
distutils.dir_util
import
mkpath
...
...
@@ -165,7 +167,7 @@ class CCompiler:
# set_executables ()
def
set_executable
(
self
,
key
,
value
):
if
type
(
value
)
is
StringType
:
if
isinstance
(
value
,
str
)
:
setattr
(
self
,
key
,
split_quoted
(
value
))
else
:
setattr
(
self
,
key
,
value
)
...
...
@@ -187,11 +189,11 @@ class CCompiler:
nothing if all definitions are OK, raise TypeError otherwise.
"""
for
defn
in
definitions
:
if
not
(
type
(
defn
)
is
TupleType
and
if
not
(
isinstance
(
defn
,
tuple
)
and
(
len
(
defn
)
==
1
or
(
len
(
defn
)
==
2
and
(
type
(
defn
[
1
])
is
StringType
or
defn
[
1
]
is
None
)))
and
type
(
defn
[
0
])
is
StringType
):
(
isinstance
(
defn
[
1
],
str
)
or
defn
[
1
]
is
None
)))
and
isinstance
(
defn
[
0
],
str
)
):
raise
TypeError
,
\
(
"invalid macro definition '%s': "
%
defn
)
+
\
"must be tuple (string,), (string, string), or "
+
\
...
...
@@ -341,19 +343,19 @@ class CCompiler:
"""
if
outdir
is
None
:
outdir
=
self
.
output_dir
elif
type
(
outdir
)
is
not
StringType
:
elif
not
isinstance
(
outdir
,
str
)
:
raise
TypeError
,
"'output_dir' must be a string or None"
if
macros
is
None
:
macros
=
self
.
macros
elif
type
(
macros
)
is
ListType
:
elif
isinstance
(
macros
,
list
)
:
macros
=
macros
+
(
self
.
macros
or
[])
else
:
raise
TypeError
,
"'macros' (if supplied) must be a list of tuples"
if
incdirs
is
None
:
incdirs
=
self
.
include_dirs
elif
type
(
incdirs
)
in
(
ListType
,
TupleType
):
elif
isinstance
(
incdirs
,
(
list
,
tuple
)
):
incdirs
=
list
(
incdirs
)
+
(
self
.
include_dirs
or
[])
else
:
raise
TypeError
,
\
...
...
@@ -444,14 +446,14 @@ class CCompiler:
if
macros
is
None
:
macros
=
self
.
macros
elif
type
(
macros
)
is
ListType
:
elif
isinstance
(
macros
,
list
)
:
macros
=
macros
+
(
self
.
macros
or
[])
else
:
raise
TypeError
,
"'macros' (if supplied) must be a list of tuples"
if
include_dirs
is
None
:
include_dirs
=
self
.
include_dirs
elif
type
(
include_dirs
)
in
(
ListType
,
TupleType
):
elif
isinstance
(
include_dirs
,
(
list
,
tuple
)
):
include_dirs
=
list
(
include_dirs
)
+
(
self
.
include_dirs
or
[])
else
:
raise
TypeError
,
\
...
...
@@ -517,14 +519,14 @@ class CCompiler:
None, replace with self.output_dir. Return fixed versions of
'objects' and 'output_dir'.
"""
if
type
(
objects
)
not
in
(
ListType
,
TupleType
):
if
not
isinstance
(
objects
,
(
list
,
tuple
)
):
raise
TypeError
,
\
"'objects' must be a list or tuple of strings"
objects
=
list
(
objects
)
if
output_dir
is
None
:
output_dir
=
self
.
output_dir
elif
type
(
output_dir
)
is
not
StringType
:
elif
not
isinstance
(
output_dir
,
str
)
:
raise
TypeError
,
"'output_dir' must be a string or None"
return
(
objects
,
output_dir
)
...
...
@@ -539,7 +541,7 @@ class CCompiler:
"""
if
libraries
is
None
:
libraries
=
self
.
libraries
elif
type
(
libraries
)
in
(
ListType
,
TupleType
):
elif
isinstance
(
libraries
,
(
list
,
tuple
)
):
libraries
=
list
(
libraries
)
+
(
self
.
libraries
or
[])
else
:
raise
TypeError
,
\
...
...
@@ -547,7 +549,7 @@ class CCompiler:
if
library_dirs
is
None
:
library_dirs
=
self
.
library_dirs
elif
type
(
library_dirs
)
in
(
ListType
,
TupleType
):
elif
isinstance
(
library_dirs
,
(
list
,
tuple
)
):
library_dirs
=
list
(
library_dirs
)
+
(
self
.
library_dirs
or
[])
else
:
raise
TypeError
,
\
...
...
@@ -555,7 +557,7 @@ class CCompiler:
if
runtime_library_dirs
is
None
:
runtime_library_dirs
=
self
.
runtime_library_dirs
elif
type
(
runtime_library_dirs
)
in
(
ListType
,
TupleType
):
elif
isinstance
(
runtime_library_dirs
,
(
list
,
tuple
)
):
runtime_library_dirs
=
(
list
(
runtime_library_dirs
)
+
(
self
.
runtime_library_dirs
or
[]))
else
:
...
...
@@ -587,7 +589,7 @@ class CCompiler:
"""Detect the language of a given file, or list of files. Uses
language_map, and language_order to do the job.
"""
if
type
(
sources
)
is
not
ListType
:
if
not
isinstance
(
sources
,
list
)
:
sources
=
[
sources
]
lang
=
None
index
=
len
(
self
.
language_order
)
...
...
@@ -1194,7 +1196,7 @@ def gen_preprocess_options (macros, include_dirs):
pp_opts
=
[]
for
macro
in
macros
:
if
not
(
type
(
macro
)
is
TupleType
and
if
not
(
isinstance
(
macro
,
tuple
)
and
1
<=
len
(
macro
)
<=
2
):
raise
TypeError
,
\
(
"bad macro definition '%s': "
+
...
...
command/bdist.py
View file @
3bd7aa02
...
...
@@ -6,9 +6,9 @@ distribution)."""
__revision__
=
"$Id$"
import
os
from
types
import
*
from
distutils.core
import
Command
from
distutils.errors
import
*
from
distutils.errors
import
DistutilsPlatformError
,
DistutilsOptionError
from
distutils.util
import
get_platform
...
...
@@ -16,7 +16,7 @@ def show_formats():
"""Print list of available formats (arguments to "--format" option).
"""
from
distutils.fancy_getopt
import
FancyGetopt
formats
=
[]
formats
=
[]
for
format
in
bdist
.
format_commands
:
formats
.
append
((
"formats="
+
format
,
None
,
bdist
.
format_command
[
format
][
1
]))
...
...
command/bdist_msi.py
View file @
3bd7aa02
...
...
@@ -28,7 +28,6 @@ class PyDialog(Dialog):
default, cancel, bitmap=true)"""
Dialog
.
__init__
(
self
,
*
args
)
ruler
=
self
.
h
-
36
bmwidth
=
152
*
ruler
/
328
#if kw.get("bitmap", True):
# self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin")
self
.
line
(
"BottomLine"
,
0
,
ruler
,
self
.
w
,
0
)
...
...
@@ -420,7 +419,6 @@ class bdist_msi (Command):
# see "Dialog Style Bits"
modal
=
3
# visible | modal
modeless
=
1
# visible
track_disk_space
=
32
# UI customization properties
add_data
(
db
,
"Property"
,
...
...
command/bdist_rpm.py
View file @
3bd7aa02
...
...
@@ -5,14 +5,15 @@ distributions)."""
__revision__
=
"$Id$"
import
sys
,
os
,
string
from
types
import
*
import
sys
import
os
import
string
from
distutils.core
import
Command
from
distutils.debug
import
DEBUG
from
distutils.util
import
get_platform
from
distutils.file_util
import
write_file
from
distutils.errors
import
*
from
distutils.sysconfig
import
get_python_version
from
distutils.errors
import
(
DistutilsOptionError
,
DistutilsPlatformError
,
DistutilsFileError
,
DistutilsExecError
)
from
distutils
import
log
class
bdist_rpm
(
Command
):
...
...
@@ -225,7 +226,7 @@ class bdist_rpm (Command):
self
.
distribution
.
get_contact_email
()))
self
.
ensure_string
(
'packager'
)
self
.
ensure_string_list
(
'doc_files'
)
if
type
(
self
.
doc_files
)
is
ListType
:
if
isinstance
(
self
.
doc_files
,
list
)
:
for
readme
in
(
'README'
,
'README.txt'
):
if
os
.
path
.
exists
(
readme
)
and
readme
not
in
self
.
doc_files
:
self
.
doc_files
.
append
(
readme
)
...
...
@@ -444,7 +445,7 @@ class bdist_rpm (Command):
'Obsoletes'
,
):
val
=
getattr
(
self
,
string
.
lower
(
field
))
if
type
(
val
)
is
ListType
:
if
isinstance
(
val
,
list
)
:
spec_file
.
append
(
'%s: %s'
%
(
field
,
string
.
join
(
val
)))
elif
val
is
not
None
:
spec_file
.
append
(
'%s: %s'
%
(
field
,
val
))
...
...
command/bdist_wininst.py
View file @
3bd7aa02
...
...
@@ -5,11 +5,14 @@ exe-program."""
__revision__
=
"$Id$"
import
sys
,
os
,
string
import
sys
import
os
import
string
from
distutils.core
import
Command
from
distutils.util
import
get_platform
from
distutils.dir_util
import
create_tree
,
remove_tree
from
distutils.errors
import
*
from
distutils.dir_util
import
remove_tree
from
distutils.errors
import
DistutilsOptionError
,
DistutilsPlatformError
from
distutils.sysconfig
import
get_python_version
from
distutils
import
log
...
...
command/build_clib.py
View file @
3bd7aa02
...
...
@@ -18,7 +18,7 @@ __revision__ = "$Id$"
import
os
from
distutils.core
import
Command
from
distutils.errors
import
*
from
distutils.errors
import
DistutilsSetupError
from
distutils.sysconfig
import
customize_compiler
from
distutils
import
log
...
...
command/build_ext.py
View file @
3bd7aa02
...
...
@@ -10,7 +10,8 @@ import sys, os, re
from
warnings
import
warn
from
distutils.core
import
Command
from
distutils.errors
import
*
from
distutils.errors
import
(
CCompilerError
,
DistutilsError
,
CompileError
,
DistutilsSetupError
,
DistutilsPlatformError
)
from
distutils.sysconfig
import
customize_compiler
,
get_python_version
from
distutils.dep_util
import
newer_group
from
distutils.extension
import
Extension
...
...
command/build_py.py
View file @
3bd7aa02
...
...
@@ -133,7 +133,6 @@ class build_py(Command):
def
build_package_data
(
self
):
"""Copy data files into build directory"""
lastdir
=
None
for
package
,
src_dir
,
build_dir
,
filenames
in
self
.
data_files
:
for
filename
in
filenames
:
target
=
os
.
path
.
join
(
build_dir
,
filename
)
...
...
command/config.py
View file @
3bd7aa02
...
...
@@ -11,7 +11,8 @@ this header file lives".
__revision__
=
"$Id$"
import
sys
,
os
,
re
import
os
import
re
from
distutils.core
import
Command
from
distutils.errors
import
DistutilsExecError
...
...
command/register.py
View file @
3bd7aa02
...
...
@@ -7,12 +7,13 @@ Implements the Distutils 'register' command (register with the repository).
__revision__
=
"$Id$"
import
os
,
string
,
urllib2
,
getpass
,
urlparse
import
urllib2
import
getpass
import
urlparse
import
StringIO
from
warnings
import
warn
from
distutils.core
import
PyPIRCCommand
from
distutils.errors
import
*
from
distutils
import
log
class
register
(
PyPIRCCommand
):
...
...
command/sdist.py
View file @
3bd7aa02
...
...
@@ -4,16 +4,17 @@ Implements the Distutils 'sdist' command (create a source distribution)."""
__revision__
=
"$Id$"
import
os
,
string
import
os
import
string
import
sys
from
types
import
*
from
glob
import
glob
from
warnings
import
warn
from
distutils.core
import
Command
from
distutils
import
dir_util
,
dep_util
,
file_util
,
archive_util
from
distutils.text_file
import
TextFile
from
distutils.errors
import
*
from
distutils.errors
import
(
DistutilsPlatformError
,
DistutilsOptionError
,
DistutilsTemplateError
)
from
distutils.filelist
import
FileList
from
distutils
import
log
from
distutils.util
import
convert_path
...
...
@@ -256,7 +257,7 @@ class sdist(Command):
standards
=
[(
'README'
,
'README.txt'
),
self
.
distribution
.
script_name
]
for
fn
in
standards
:
if
type
(
fn
)
is
TupleType
:
if
isinstance
(
fn
,
tuple
)
:
alts
=
fn
got_it
=
0
for
fn
in
alts
:
...
...
command/upload.py
View file @
3bd7aa02
"""distutils.command.upload
Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
import
sys
import
os
import
socket
import
platform
...
...
@@ -9,10 +8,9 @@ from urllib2 import urlopen, Request, HTTPError
from
base64
import
standard_b64encode
import
urlparse
import
cStringIO
as
StringIO
from
ConfigParser
import
ConfigParser
from
hashlib
import
md5
from
distutils.errors
import
*
from
distutils.errors
import
DistutilsOptionError
from
distutils.core
import
PyPIRCCommand
from
distutils.spawn
import
spawn
from
distutils
import
log
...
...
config.py
View file @
3bd7aa02
...
...
@@ -4,7 +4,6 @@ Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
"""
import
os
import
sys
from
ConfigParser
import
ConfigParser
from
distutils.cmd
import
Command
...
...
@@ -60,8 +59,6 @@ class PyPIRCCommand(Command):
if
os
.
path
.
exists
(
rc
):
self
.
announce
(
'Using PyPI login from %s'
%
rc
)
repository
=
self
.
repository
or
self
.
DEFAULT_REPOSITORY
realm
=
self
.
realm
or
self
.
DEFAULT_REALM
config
=
ConfigParser
()
config
.
read
(
rc
)
sections
=
config
.
sections
()
...
...
core.py
View file @
3bd7aa02
...
...
@@ -8,10 +8,12 @@ really defined in distutils.dist and distutils.cmd.
__revision__
=
"$Id$"
import
sys
,
os
import
sys
import
os
from
distutils.debug
import
DEBUG
from
distutils.errors
import
*
from
distutils.errors
import
(
DistutilsSetupError
,
DistutilsArgError
,
DistutilsError
,
CCompilerError
)
from
distutils.util
import
grok_environment_error
# Mainly import these so setup scripts can "from distutils.core import" them.
...
...
@@ -31,7 +33,7 @@ usage: %(script)s [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: %(script)s cmd --help
"""
def
gen_usage
(
script_name
):
def
gen_usage
(
script_name
):
script
=
os
.
path
.
basename
(
script_name
)
return
USAGE
%
vars
()
...
...
@@ -56,7 +58,7 @@ extension_keywords = ('name', 'sources', 'include_dirs',
'extra_objects'
,
'extra_compile_args'
,
'extra_link_args'
,
'swig_opts'
,
'export_symbols'
,
'depends'
,
'language'
)
def
setup
(
**
attrs
):
def
setup
(
**
attrs
):
"""The gateway to the Distutils: do everything your setup script needs
to do, in a highly flexible and user-driven way. Briefly: create a
Distribution instance; find and parse config files; parse the command
...
...
@@ -168,10 +170,8 @@ def setup (**attrs):
return
dist
# setup ()
def
run_setup
(
script_name
,
script_args
=
None
,
stop_after
=
"run"
):
def
run_setup
(
script_name
,
script_args
=
None
,
stop_after
=
"run"
):
"""Run a setup script in a somewhat controlled environment, and
return the Distribution instance that drives things. This is useful
if you need to find out the distribution meta-data (passed as
...
...
@@ -235,7 +235,4 @@ def run_setup (script_name, script_args=None, stop_after="run"):
# I wonder if the setup script's namespace -- g and l -- would be of
# any interest to callers?
#print "_setup_distribution:", _setup_distribution
return
_setup_distribution
# run_setup ()
cygwinccompiler.py
View file @
3bd7aa02
...
...
@@ -53,11 +53,9 @@ import copy
import
re
from
warnings
import
warn
from
distutils.ccompiler
import
gen_preprocess_options
,
gen_lib_options
from
distutils.unixccompiler
import
UnixCCompiler
from
distutils.file_util
import
write_file
from
distutils.errors
import
DistutilsExecError
,
CompileError
,
UnknownFileError
from
distutils
import
log
from
distutils.util
import
get_compiler_versions
def
get_msvcr
():
...
...
dir_util.py
View file @
3bd7aa02
...
...
@@ -4,7 +4,7 @@ Utility functions for manipulating directories and directory trees."""
__revision__
=
"$Id$"
import
os
,
sys
import
os
from
distutils.errors
import
DistutilsFileError
,
DistutilsInternalError
from
distutils
import
log
...
...
dist.py
View file @
3bd7aa02
...
...
@@ -14,7 +14,8 @@ try:
except
ImportError
:
warnings
=
None
from
distutils.errors
import
*
from
distutils.errors
import
(
DistutilsOptionError
,
DistutilsArgError
,
DistutilsModuleError
,
DistutilsClassError
)
from
distutils.fancy_getopt
import
FancyGetopt
,
translate_longopt
from
distutils.util
import
check_environ
,
strtobool
,
rfc822_escape
from
distutils
import
log
...
...
emxccompiler.py
View file @
3bd7aa02
...
...
@@ -24,11 +24,9 @@ __revision__ = "$Id$"
import
os
,
sys
,
copy
from
warnings
import
warn
from
distutils.ccompiler
import
gen_preprocess_options
,
gen_lib_options
from
distutils.unixccompiler
import
UnixCCompiler
from
distutils.file_util
import
write_file
from
distutils.errors
import
DistutilsExecError
,
CompileError
,
UnknownFileError
from
distutils
import
log
from
distutils.util
import
get_compiler_versions
class
EMXCCompiler
(
UnixCCompiler
):
...
...
extension.py
View file @
3bd7aa02
...
...
@@ -6,7 +6,6 @@ modules in setup scripts."""
__revision__
=
"$Id$"
import
os
import
sys
import
warnings
# This class is really only used by the "build_ext" command, so it might
...
...
fancy_getopt.py
View file @
3bd7aa02
...
...
@@ -10,10 +10,11 @@ additional features:
__revision__
=
"$Id$"
import
sys
,
string
,
re
from
types
import
*
import
sys
import
string
import
re
import
getopt
from
distutils.errors
import
*
from
distutils.errors
import
DistutilsGetoptError
,
DistutilsArgError
# Much like command_re in distutils.core, this is close to but not quite
# the same as a Python NAME -- except, in the spirit of most GNU
...
...
@@ -117,7 +118,7 @@ class FancyGetopt:
def
_check_alias_dict
(
self
,
aliases
,
what
):
assert
type
(
aliases
)
is
DictionaryType
assert
isinstance
(
aliases
,
dict
)
for
(
alias
,
opt
)
in
aliases
.
items
():
if
alias
not
in
self
.
option_index
:
raise
DistutilsGetoptError
,
\
...
...
@@ -164,13 +165,13 @@ class FancyGetopt:
raise
ValueError
,
"invalid option tuple: %r"
%
(
option
,)
# Type- and value-check the option names
if
type
(
long
)
is
not
StringType
or
len
(
long
)
<
2
:
if
not
isinstance
(
long
,
str
)
or
len
(
long
)
<
2
:
raise
DistutilsGetoptError
,
\
(
"invalid long option '%s': "
"must be a string of length >= 2"
)
%
long
if
(
not
((
short
is
None
)
or
(
type
(
short
)
is
StringType
and
len
(
short
)
==
1
))):
(
isinstance
(
short
,
str
)
and
len
(
short
)
==
1
))):
raise
DistutilsGetoptError
,
\
(
"invalid short option '%s': "
"must a single character or None"
)
%
short
...
...
@@ -464,10 +465,8 @@ def wrap_text (text, width):
return
lines
# wrap_text ()
def
translate_longopt
(
opt
):
def
translate_longopt
(
opt
):
"""Convert a long option name to a valid Python identifier by
changing "-" to "_".
"""
...
...
@@ -483,18 +482,3 @@ class OptionDummy:
'options' will be initialized to None."""
for
opt
in
options
:
setattr
(
self
,
opt
,
None
)
# class OptionDummy
if
__name__
==
"__main__"
:
text
=
"""
\
Tra-la-la, supercalifragilisticexpialidocious.
How *do* you spell that odd word, anyways?
(Someone ask Mary -- she'll know [or she'll
say, "How should I know?"].)"""
for
w
in
(
10
,
20
,
30
,
40
):
print
"width: %d"
%
w
print
string
.
join
(
wrap_text
(
text
,
w
),
"
\
n
"
)
print
msvc9compiler.py
View file @
3bd7aa02
...
...
@@ -19,10 +19,9 @@ import subprocess
import
sys
import
re
from
distutils.errors
import
DistutilsExecError
,
DistutilsPlatformError
,
\
CompileError
,
LibError
,
LinkError
from
distutils.ccompiler
import
CCompiler
,
gen_preprocess_options
,
\
gen_lib_options
from
distutils.errors
import
(
DistutilsExecError
,
DistutilsPlatformError
,
CompileError
,
LibError
,
LinkError
)
from
distutils.ccompiler
import
CCompiler
,
gen_lib_options
from
distutils
import
log
from
distutils.util
import
get_platform
...
...
msvccompiler.py
View file @
3bd7aa02
...
...
@@ -10,12 +10,13 @@ for the Microsoft Visual Studio.
__revision__
=
"$Id$"
import
sys
,
os
,
string
from
distutils.errors
import
\
DistutilsExecError
,
DistutilsPlatformError
,
\
CompileError
,
LibError
,
LinkError
from
distutils.ccompiler
import
\
CCompiler
,
gen_preprocess_options
,
gen_lib_options
import
sys
import
os
import
string
from
distutils.errors
import
(
DistutilsExecError
,
DistutilsPlatformError
,
CompileError
,
LibError
,
LinkError
)
from
distutils.ccompiler
import
CCompiler
,
gen_lib_options
from
distutils
import
log
_can_read_reg
=
0
...
...
@@ -127,7 +128,7 @@ class MacroExpander:
self.set_macro("
FrameworkSDKDir
", net, "
sdkinstallrootv1
.
1
")
else:
self.set_macro("
FrameworkSDKDir
", net, "
sdkinstallroot
")
except KeyError
, exc: #
except KeyError
:
raise DistutilsPlatformError,
\
("""Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
...
...
text_file.py
View file @
3bd7aa02
...
...
@@ -6,8 +6,7 @@ lines, and joining lines with backslashes."""
__revision__
=
"$Id$"
from
types
import
*
import
sys
,
os
,
string
import
sys
class
TextFile
:
...
...
@@ -137,12 +136,12 @@ class TextFile:
if
line
is
None
:
line
=
self
.
current_line
outmsg
.
append
(
self
.
filename
+
", "
)
if
type
(
line
)
in
(
ListType
,
TupleType
):
if
isinstance
(
line
,
(
list
,
tuple
)
):
outmsg
.
append
(
"lines %d-%d: "
%
tuple
(
line
))
else
:
outmsg
.
append
(
"line %d: "
%
line
)
outmsg
.
append
(
str
(
msg
))
return
string
.
join
(
outmsg
,
""
)
return
''
.
join
(
outmsg
)
def
error
(
self
,
msg
,
line
=
None
):
...
...
@@ -196,7 +195,7 @@ class TextFile:
# unescape it (and any other escaped "#"'s that might be
# lurking in there) and otherwise leave the line alone.
pos
=
string
.
find
(
line
,
"#"
)
pos
=
line
.
find
(
"#"
)
if
pos
==
-
1
:
# no "#" -- no comments
pass
...
...
@@ -219,11 +218,11 @@ class TextFile:
# # comment that should be ignored
# there
# result in "hello there".
if
string
.
strip
(
line
)
==
""
:
if
line
.
strip
(
)
==
""
:
continue
else
:
# it's an escaped "#"
line
=
string
.
replace
(
line
,
"
\
\
#"
,
"#"
)
line
=
line
.
replace
(
"
\
\
#"
,
"#"
)
# did previous line end with a backslash? then accumulate
...
...
@@ -235,11 +234,11 @@ class TextFile:
return
buildup_line
if
self
.
collapse_join
:
line
=
string
.
lstrip
(
line
)
line
=
line
.
lstrip
(
)
line
=
buildup_line
+
line
# careful: pay attention to line number when incrementing it
if
type
(
self
.
current_line
)
is
ListType
:
if
isinstance
(
self
.
current_line
,
list
)
:
self
.
current_line
[
1
]
=
self
.
current_line
[
1
]
+
1
else
:
self
.
current_line
=
[
self
.
current_line
,
...
...
@@ -250,7 +249,7 @@ class TextFile:
return
None
# still have to be careful about incrementing the line number!
if
type
(
self
.
current_line
)
is
ListType
:
if
isinstance
(
self
.
current_line
,
list
)
:
self
.
current_line
=
self
.
current_line
[
1
]
+
1
else
:
self
.
current_line
=
self
.
current_line
+
1
...
...
@@ -259,11 +258,11 @@ class TextFile:
# strip whitespace however the client wants (leading and
# trailing, or one or the other, or neither)
if
self
.
lstrip_ws
and
self
.
rstrip_ws
:
line
=
string
.
strip
(
line
)
line
=
line
.
strip
(
)
elif
self
.
lstrip_ws
:
line
=
string
.
lstrip
(
line
)
line
=
line
.
lstrip
(
)
elif
self
.
rstrip_ws
:
line
=
string
.
rstrip
(
line
)
line
=
line
.
rstrip
(
)
# blank line (whether we rstrip'ed or not)? skip to next line
# if appropriate
...
...
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