Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
00e0db82
Commit
00e0db82
authored
Apr 05, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make_dist.py: remove --rsync option. add new --fast and --revert options.
parent
0d8265a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
20 deletions
+68
-20
util/make_dist.py
util/make_dist.py
+68
-20
No files found.
util/make_dist.py
View file @
00e0db82
#!/usr/bin/python
# Copyright (C) 2012 Denis Bilenko (http://denisbilenko.com)
"""
Create a source distribution of gevent.
Does the following:
- Clones the repo into a temporary location.
- Run set_version.py that will update gevent/__init__.py.
- Run 'python setup.py sdist'.
If --fast is provided, then fast copying with hard-links is used instead of cloning.
If --revert is provided, then copying is done and then changes are reverted.
"""
import
sys
import
os
import
glob
import
optparse
TMPDIR
=
'gevent-make-dist'
TMPDIR
=
'/tmp/gevent-make-dist'
useful_files
=
[
'gevent/core.pyx'
,
'gevent/gevent.core.h'
,
'gevent/gevent.core.c'
,
'gevent/gevent.ares.h'
,
'gevent/gevent.ares.c'
,
'gevent/gevent._semaphore.c'
,
'gevent/gevent._semaphore.h'
]
def
system
(
cmd
):
print
cmd
def
system
(
cmd
,
noisy
=
True
):
if
noisy
:
print
cmd
res
=
os
.
system
(
cmd
)
if
res
:
sys
.
exit
(
'%r failed with %s'
%
(
cmd
,
res
))
def
iter_status
(
command
):
for
line
in
os
.
popen
(
command
).
readlines
():
line
=
line
.
strip
()
if
line
:
assert
line
[
1
]
==
' '
and
line
[
0
]
!=
' '
and
line
[
2
]
!=
' '
,
repr
(
line
)
yield
line
[:
1
],
line
[
1
:].
strip
()
def
main
():
assert
os
.
path
.
exists
(
'gevent/__init__.py'
),
'Where am I?'
basedir
=
os
.
path
.
abspath
(
os
.
getcwd
())
parser
=
optparse
.
OptionParser
()
parser
.
add_option
(
'--rsync'
,
action
=
'store_true'
)
parser
.
add_option
(
'--fast'
,
action
=
'store_true'
,
help
=
'Rather than cloning the repo, hard link the files in it'
)
parser
.
add_option
(
'--revert'
,
action
=
'store_true'
,
help
=
'Same as --fast, but also do "hg revert -a" before start'
)
options
,
args
=
parser
.
parse_args
()
if
len
(
args
)
!=
1
:
sys
.
exit
(
'Expected one argument: version (could be "dev")'
)
if
options
.
revert
:
options
.
fast
=
True
if
len
(
args
)
!=
1
:
sys
.
exit
(
'Expected one argument: version (could be "dev").'
)
version
=
args
[
0
]
if
version
.
lower
()
==
'dev'
:
...
...
@@ -33,35 +65,51 @@ def main():
else
:
set_version_command
=
'util/set_version.py --version %s gevent/__init__.py'
%
version
if
options
.
rsync
:
copy_command
=
'rsync -r %s .'
%
basedir
else
:
copy_command
=
'hg clone %s'
%
basedir
os
.
chdir
(
'/tmp'
)
system
(
'rm -fr '
+
TMPDIR
)
os
.
mkdir
(
TMPDIR
)
os
.
chdir
(
TMPDIR
)
system
(
copy_command
)
if
options
.
fast
:
system
(
'cp -al %s .'
%
basedir
)
else
:
system
(
'hg clone %s gevent'
%
basedir
)
directory
=
os
.
listdir
(
'.'
)
assert
len
(
directory
)
==
1
,
directory
os
.
chdir
(
directory
[
0
])
if
options
.
fast
:
system
(
'rm -fr build doc/_build dist'
)
status_command
=
'hg status --unknown --ignored'
if
options
.
revert
:
status_command
+=
' --modified --added'
for
status
,
name
in
iter_status
(
status_command
):
if
name
not
in
useful_files
:
os
.
unlink
(
name
)
if
options
.
revert
:
system
(
'hg revert -a'
)
for
root
,
dirs
,
files
in
os
.
walk
(
'.'
,
topdown
=
False
):
if
not
dirs
and
not
files
:
print
'Removing empty directory %r'
%
root
os
.
rmdir
(
root
)
system
(
set_version_command
)
system
(
'hg diff'
)
if
options
.
rsync
:
system
(
'rm -fr dist'
)
system
(
'python setup.py sdist'
)
system
(
'hg diff'
,
noisy
=
False
)
system
(
'python setup.py -q sdist'
)
dist_filename
=
glob
.
glob
(
'dist/gevent-*.tar.gz'
)
assert
len
(
dist_filename
)
==
1
,
dist_filename
dist_filename
=
os
.
path
.
abspath
(
dist_filename
[
0
])
website_di
r
=
os
.
path
.
join
(
os
.
path
.
dirname
(
basedir
),
'gevent-website
'
)
if
os
.
path
.
exists
(
website_dir
):
system
(
'cp %s %s
/dist'
%
(
dist_filename
,
website
_dir
))
system
(
'ln -f
s %s /tmp'
%
dist_filename
)
website_di
st_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
basedir
),
'gevent-website'
,
'dist
'
)
if
os
.
path
.
exists
(
website_di
st_di
r
):
system
(
'cp %s %s
'
%
(
dist_filename
,
website_dist
_dir
))
system
(
'ln -f
%s %s/'
%
(
dist_filename
,
TMPDIR
)
)
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