Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python-defaults
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
python-defaults
Commits
105610c3
Commit
105610c3
authored
14 years ago
by
Piotr Ożarowski
Browse files
Options
Downloads
Patches
Plain Diff
dh_python2: egg renaming fixed
parent
1645ad5a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
debian/changelog
+6
-0
6 additions, 0 deletions
debian/changelog
debpython/tools.py
+15
-0
15 additions, 0 deletions
debpython/tools.py
dh_python2
+12
-14
12 additions, 14 deletions
dh_python2
with
33 additions
and
14 deletions
debian/changelog
+
6
−
0
View file @
105610c3
python-defaults (2.6.6-3) UNRELEASED; urgency=low
* dh_python2: egg renaming fixed
-- Piotr Ożarowski <piotr@debian.org> Wed, 15 Sep 2010 00:10:01 +0200
python-defaults (2.6.6-2) experimental; urgency=low
[ Piotr Ożarowski ]
...
...
This diff is collapsed.
Click to expand it.
debpython/tools.py
+
15
−
0
View file @
105610c3
...
...
@@ -27,6 +27,7 @@ from os import symlink
from
debpython.version
import
getver
log
=
logging
.
getLogger
(
__name__
)
EGGnPTH_RE
=
re
.
compile
(
r
'
(.*?)(-py\d\.\d(?:-[^.]*)?)?(\.egg-info|\.pth)$
'
)
SHEBANG_RE
=
re
.
compile
(
r
'
^#!\s*/usr/bin/(?:env\s+)?(python(\d+\.\d+)?(?:-dbg)?).*
'
)
...
...
@@ -93,6 +94,20 @@ def shebang2pyver(fname):
log
.
error
(
'
cannot open %s
'
,
fname
)
def
clean_egg_name
(
name
):
"""
Remove Python version and platform name from Egg files/dirs.
>>>
clean_egg_name
(
'
python_pipeline-0.1.3_py3k-py3.1.egg-info
'
)
'
python_pipeline-0.1.3_py3k.egg-info
'
>>>
clean_egg_name
(
'
Foo-1.2-py2.7-linux-x86_64.egg-info
'
)
'
Foo-1.2.egg-info
'
"""
match
=
EGGnPTH_RE
.
match
(
name
)
if
match
and
match
.
group
(
2
)
is
not
None
:
return
''
.
join
(
match
.
group
(
1
,
3
))
return
name
class
memoize
(
object
):
def
__init__
(
self
,
func
):
self
.
func
=
func
...
...
This diff is collapsed.
Click to expand it.
dh_python2
+
12
−
14
View file @
105610c3
...
...
@@ -40,7 +40,7 @@ from debpython.version import SUPPORTED, DEFAULT, \
from
debpython.pydist
import
validate
as
validate_pydist
,
\
PUBLIC_DIR_RE
from
debpython.tools
import
sitedir
,
relative_symlink
,
\
shebang2pyver
shebang2pyver
,
clean_egg_name
from
debpython.option
import
Option
# initialize script
...
...
@@ -306,21 +306,20 @@ def scan(package, dname=None):
if
len
(
root
.
split
(
'
/
'
,
6
))
<
6
and
(
\
root
.
endswith
(
'
/sbin
'
)
or
root
.
endswith
(
'
/bin
'
)
or
\
root
.
endswith
(
'
/usr/games
'
)):
# /bin or /usr/bin or /usr/games
# /
(s)
bin or /usr/
(s)
bin or /usr/games
bin_dir
=
root
# handle some EGG related data (.egg-info dirs)
for
name
in
dirs
:
match
=
EGGnPTH_RE
.
match
(
name
)
if
match
:
if
name
.
endswith
(
'
.egg-info
'
):
if
dbg_package
:
rmtree
(
join
(
root
,
name
))
dirs
.
pop
(
dirs
.
index
(
name
))
continue
if
match
.
group
(
2
)
is
not
None
:
new
_name
=
''
.
join
(
match
.
group
(
1
,
3
,
4
))
log
.
debug
(
'
renaming %s to %s
'
,
name
,
new
_name
)
os
.
rename
(
join
(
root
,
name
),
join
(
root
,
new
_name
))
clean_name
=
clean_egg_name
(
name
)
if
clean
_name
!
=
name
:
log
.
info
(
'
renaming %s to %s
'
,
name
,
clean
_name
)
os
.
rename
(
join
(
root
,
name
),
join
(
root
,
clean
_name
))
if
root
.
endswith
(
'
.egg-info
'
)
and
'
requires.txt
'
in
file_names
:
r
[
'
requires.txt
'
].
add
(
join
(
root
,
'
requires.txt
'
))
continue
...
...
@@ -357,12 +356,11 @@ def scan(package, dname=None):
continue
# .egg-info files
match
=
EGGnPTH_RE
.
match
(
fn
)
if
match
:
if
match
.
group
(
2
)
is
not
None
:
new_name
=
''
.
join
(
match
.
group
(
1
,
3
,
4
))
log
.
debug
(
'
renaming %s to %s
'
,
fn
,
new_name
)
os
.
rename
(
join
(
root
,
fn
),
join
(
root
,
new_name
))
if
fn
.
endswith
(
'
.egg-info
'
):
clean_name
=
clean_egg_name
(
fn
)
if
clean_name
!=
fn
:
log
.
info
(
'
renaming %s to %s
'
,
fn
,
clean_name
)
os
.
rename
(
join
(
root
,
fn
),
join
(
root
,
clean_name
))
continue
# search for scripts in bin dirs
if
bin_dir
:
...
...
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