Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.ip.flandmark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.ip.flandmark
Commits
a91b13c1
Commit
a91b13c1
authored
10 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Added latest bootstrap.py
parent
8b29e174
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bootstrap.py
+48
-42
48 additions, 42 deletions
bootstrap.py
with
48 additions
and
42 deletions
bootstrap.py
+
48
−
42
View file @
a91b13c1
...
@@ -56,6 +56,11 @@ parser.add_option("-c", "--config-file",
...
@@ -56,6 +56,11 @@ parser.add_option("-c", "--config-file",
"
file to be used.
"
))
"
file to be used.
"
))
parser
.
add_option
(
"
-f
"
,
"
--find-links
"
,
parser
.
add_option
(
"
-f
"
,
"
--find-links
"
,
help
=
(
"
Specify a URL to search for buildout releases
"
))
help
=
(
"
Specify a URL to search for buildout releases
"
))
parser
.
add_option
(
"
--allow-site-packages
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
(
"
Let bootstrap.py use existing site packages
"
))
parser
.
add_option
(
"
--setuptools-version
"
,
help
=
"
use a specific setuptools version
"
)
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
()
...
@@ -63,45 +68,42 @@ options, args = parser.parse_args()
...
@@ -63,45 +68,42 @@ options, args = parser.parse_args()
######################################################################
######################################################################
# load/install setuptools
# load/install setuptools
to_reload
=
False
try
:
try
:
import
pkg_resources
if
options
.
allow_site_packages
:
import
setuptools
import
setuptools
import
pkg_resources
from
urllib.request
import
urlopen
except
ImportError
:
except
ImportError
:
ez
=
{}
from
urllib2
import
urlopen
try
:
from
urllib.request
import
urlopen
except
ImportError
:
from
urllib2
import
urlopen
# XXX use a more permanent ez_setup.py URL when available.
exec
(
urlopen
(
'
https://bitbucket.org/pypa/setuptools/raw/0.7.2/ez_setup.py
'
).
read
(),
ez
)
setup_args
=
dict
(
to_dir
=
tmpeggs
,
download_delay
=
0
)
ez
[
'
use_setuptools
'
](
**
setup_args
)
if
to_reload
:
reload
(
pkg_resources
)
import
pkg_resources
# This does not (always?) update the default working set. We will
# do it.
for
path
in
sys
.
path
:
if
path
not
in
pkg_resources
.
working_set
.
entries
:
pkg_resources
.
working_set
.
add_entry
(
path
)
######################################################################
ez
=
{}
# Try to best guess the version of buildout given setuptools
exec
(
urlopen
(
'
https://bootstrap.pypa.io/ez_setup.py
'
).
read
(),
ez
)
if
options
.
version
is
None
:
if
not
options
.
allow_site_packages
:
try
:
# ez_setup imports site, which adds site packages
from
distutils.version
import
LooseVersion
# this will remove them from the path to ensure that incompatible versions
package
=
pkg_resources
.
require
(
'
setuptools
'
)[
0
]
# of setuptools are not in the path
v
=
LooseVersion
(
package
.
version
)
import
site
if
v
<
LooseVersion
(
'
0.7
'
):
# inside a virtualenv, there is no 'getsitepackages'.
options
.
version
=
'
2.1.1
'
# We can't remove these reliably
except
:
if
hasattr
(
site
,
'
getsitepackages
'
):
pass
for
sitepackage_path
in
site
.
getsitepackages
():
sys
.
path
[:]
=
[
x
for
x
in
sys
.
path
if
sitepackage_path
not
in
x
]
setup_args
=
dict
(
to_dir
=
tmpeggs
,
download_delay
=
0
)
if
options
.
setuptools_version
is
not
None
:
setup_args
[
'
version
'
]
=
options
.
setuptools_version
ez
[
'
use_setuptools
'
](
**
setup_args
)
import
setuptools
import
pkg_resources
# This does not (always?) update the default working set. We will
# do it.
for
path
in
sys
.
path
:
if
path
not
in
pkg_resources
.
working_set
.
entries
:
pkg_resources
.
working_set
.
add_entry
(
path
)
######################################################################
######################################################################
# Install buildout
# Install buildout
...
@@ -132,10 +134,15 @@ if version is None and not options.accept_buildout_test_releases:
...
@@ -132,10 +134,15 @@ if version is None and not options.accept_buildout_test_releases:
_final_parts
=
'
*final-
'
,
'
*final
'
_final_parts
=
'
*final-
'
,
'
*final
'
def
_final_version
(
parsed_version
):
def
_final_version
(
parsed_version
):
for
part
in
parsed_version
:
try
:
if
(
part
[:
1
]
==
'
*
'
)
and
(
part
not
in
_final_parts
):
return
not
parsed_version
.
is_prerelease
return
False
except
AttributeError
:
return
True
# Older setuptools
for
part
in
parsed_version
:
if
(
part
[:
1
]
==
'
*
'
)
and
(
part
not
in
_final_parts
):
return
False
return
True
index
=
setuptools
.
package_index
.
PackageIndex
(
index
=
setuptools
.
package_index
.
PackageIndex
(
search_path
=
[
setuptools_path
])
search_path
=
[
setuptools_path
])
if
find_links
:
if
find_links
:
...
@@ -162,8 +169,7 @@ cmd.append(requirement)
...
@@ -162,8 +169,7 @@ cmd.append(requirement)
import
subprocess
import
subprocess
if
subprocess
.
call
(
cmd
,
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
setuptools_path
))
!=
0
:
if
subprocess
.
call
(
cmd
,
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
setuptools_path
))
!=
0
:
raise
Exception
(
raise
Exception
(
"
Failed to execute command:
\n
%s
"
,
"
Failed to execute command:
\n
%s
"
%
repr
(
cmd
)[
1
:
-
1
])
repr
(
cmd
)[
1
:
-
1
])
######################################################################
######################################################################
# Import and run buildout
# Import and run buildout
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment