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
a72ccb07
Commit
a72ccb07
authored
14 years ago
by
Piotr Ożarowski
Browse files
Options
Downloads
Patches
Plain Diff
add support for debian/pydist-overrides
parent
63a3ef12
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
debian/changelog
+3
-1
3 additions, 1 deletion
debian/changelog
debpython/pydist.py
+28
-25
28 additions, 25 deletions
debpython/pydist.py
tests/t1/debian/pydist-overrides
+2
-0
2 additions, 0 deletions
tests/t1/debian/pydist-overrides
tests/t1/setup.py
+1
-1
1 addition, 1 deletion
tests/t1/setup.py
with
34 additions
and
27 deletions
debian/changelog
+
3
−
1
View file @
a72ccb07
python-defaults (2.6.5-2) UNRELEASED; urgency=low
[ Piotr Ożarowski ]
* dh_python2: Create extension symlinks in /usr/lib/pyshared/pythonX.Y
* dh_python2:
- create extension symlinks in /usr/lib/pyshared/pythonX.Y
- add support for debian/pydist-overrides
* Support for Python3 removed in dh_python2, pycompile and pyclean
(moved to python3-defaults)
* debian/copyright: Add a note about dh_python2, pycompile, pyclean and
...
...
This diff is collapsed.
Click to expand it.
debpython/pydist.py
+
28
−
25
View file @
a72ccb07
...
...
@@ -23,10 +23,10 @@ from __future__ import with_statement
import
logging
import
os
import
re
from
os.path
import
join
,
isdir
from
os.path
import
exists
,
isdir
,
join
from
subprocess
import
PIPE
,
Popen
from
sys
import
exit
from
debpython.version
import
vrepr
,
getver
,
parse_vrange
from
debpython.version
import
vrepr
,
getver
,
get_requested_versions
from
debpython.tools
import
memoize
log
=
logging
.
getLogger
(
'
dh_python
'
)
...
...
@@ -63,15 +63,16 @@ def validate(fpath, exit=False):
@memoize
def
load
(
dname
=
'
/usr/share/python/dist/
'
):
def
load
(
dname
=
'
/usr/share/python/dist/
'
,
fname
=
'
debian/pydist-overrides
'
):
"""
Load iformation about installed Python distributions.
"""
if
not
isdir
(
dname
):
log
.
warn
(
'
%s is not a dir
'
,
dname
)
return
{}
if
exists
(
fname
):
to_check
=
[
fname
]
# first one!
if
isdir
(
dname
):
to_check
.
extend
(
join
(
dname
,
i
)
for
i
in
os
.
listdir
(
dname
))
result
=
{}
for
f
name
in
os
.
listdir
(
dname
)
:
with
open
(
join
(
dname
,
fname
)
)
as
fp
:
for
f
path
in
to_check
:
with
open
(
fpath
)
as
fp
:
for
line
in
fp
:
line
=
line
.
strip
(
'
\r\n
'
)
if
line
.
startswith
(
'
#
'
)
or
not
line
:
...
...
@@ -79,16 +80,13 @@ def load(dname='/usr/share/python/dist/'):
line
=
line
.
strip
()
dist
=
PYDIST_RE
.
search
(
line
).
groupdict
()
name
=
dist
[
'
name
'
].
lower
()
if
name
in
result
:
log
.
error
(
'
Python distribution %s already listed twice
'
'
(last file: %s)
'
,
join
(
dname
,
fname
))
dist
[
'
vrange
'
]
=
parse_vrange
(
dist
[
'
vrange
'
])
dist
[
'
versions
'
]
=
get_requested_versions
(
dist
[
'
vrange
'
])
dist
[
'
dependency
'
]
=
dist
[
'
dependency
'
].
strip
()
if
dist
[
'
rules
'
]:
dist
[
'
rules
'
]
=
dist
[
'
rules
'
].
split
(
'
;
'
)
else
:
dist
[
'
rules
'
]
=
[]
result
[
name
]
=
dist
result
.
setdefault
(
name
,
[]).
append
(
dist
)
return
result
...
...
@@ -97,24 +95,30 @@ def guess_dependency(req, version):
req
,
vrepr
(
version
)
if
version
else
None
)
if
isinstance
(
version
,
basestring
):
version
=
getver
(
version
)
data
=
load
()
req
=
req
.
split
(
'
'
,
1
)
name
=
req
[
0
].
lower
()
if
len
(
req
)
>
1
:
req_version
=
req
[
1
]
.
split
(
'
,
'
)
# FIXME: check requires.txt syntax
req_version
=
req
[
1
]
# r"\s*(<=?|>=?|==|!=)\s*((\w|[-.])+)"
else
:
req_version
=
[]
req_version
=
''
details
=
data
.
get
(
name
)
if
details
:
if
details
[
'
dependency
'
].
endswith
(
'
)
'
):
# no need to translate versions if version is hardcoded in Debian
# dependency
return
data
[
name
][
'
dependency
'
]
if
req_version
:
# FIXME: rules, versions
pass
else
:
return
data
[
name
][
'
dependency
'
]
for
item
in
details
:
if
version
not
in
item
.
get
(
'
versions
'
,
version
):
# rule doesn't match version, try next one
continue
if
item
[
'
dependency
'
].
endswith
(
'
)
'
):
# no need to translate versions if version is hardcoded in Debian
# dependency
return
item
[
'
dependency
'
]
if
req_version
:
# FIXME: translate it (rules, versions)
return
item
[
'
dependency
'
]
else
:
return
item
[
'
dependency
'
]
# try dpkg -S
...
...
@@ -135,7 +139,6 @@ def guess_dependency(req, version):
log
.
error
(
'
Cannot find package that provides %s.
'
,
name
)
log
.
info
(
"
hint: `apt-file search -x
'
(packages|pyshared)/
"
+
\
"
%s
'
-l` might help
"
,
name
)
# TODO: false positive - .pydist
exit
(
8
)
result
=
set
()
...
...
This diff is collapsed.
Click to expand it.
tests/t1/debian/pydist-overrides
0 → 100644
+
2
−
0
View file @
a72ccb07
Mako python-mako (>= 0.2)
SQLAlchemy python-sqlalchemy (<< 0.6)
This diff is collapsed.
Click to expand it.
tests/t1/setup.py
+
1
−
1
View file @
a72ccb07
...
...
@@ -15,5 +15,5 @@ setup(name='Foo',
packages
=
find_packages
(
'
lib/
'
),
package_data
=
{
'
foo
'
:
[
'
jquery.js
'
]},
zip_safe
=
False
,
#
install_requires = ['Mako', 'SQLAlchemy >=0.5'],
install_requires
=
[
'
Mako
'
,
'
SQLAlchemy >=0.5
'
],
)
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