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
542a2746
Commit
542a2746
authored
14 years ago
by
Piotr Ożarowski
Browse files
Options
Downloads
Patches
Plain Diff
py_builddir: strip "python" form the argument (if set)
parent
378f0f6e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/python.mk
+1
-1
1 addition, 1 deletion
debian/python.mk
dh_python2
+21
-3
21 additions, 3 deletions
dh_python2
with
22 additions
and
4 deletions
debian/python.mk
+
1
−
1
View file @
542a2746
...
...
@@ -31,7 +31,7 @@ py_libdir = /usr/lib/python$(strip $(if $(findstring 3.,$(subst python,,$(1))),3
py_pkgname
=
$(
if
$(
findstring 3.,
$(
2
))
,
$(
subst python-,python3-,
$(
1
))
,
$(
1
))
# distutils' build directory
py_builddir
=
$(
shell python
$(
strip
$(
1
))
-c
'from distutils.command.build import build; from distutils.core import Distribution; b = build(Distribution(
)
); b.finalize_options(); print(b.build_platlib)'
)
py_builddir
=
$(
shell python
$(
strip
$(
subst python,,
$(
1
)
))
-c
'from distutils.command.build import build; from distutils.core import Distribution; b = build(Distribution(
)
); b.finalize_options(); print(b.build_platlib)'
)
# The same macros for use inside loops in shell snippets
...
...
This diff is collapsed.
Click to expand it.
dh_python2
+
21
−
3
View file @
542a2746
#! /usr/bin/python
# -*- coding: UTF-8 -*- vim: et ts=4 sw=4
# Copyright © 2010 Piotr Ożarowski <piotr@debian.org>
# Copyright © 2010
-2011
Piotr Ożarowski <piotr@debian.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
...
...
@@ -37,6 +37,7 @@ from debpython.depends import Dependencies
from
debpython.version
import
SUPPORTED
,
DEFAULT
,
\
debsorted
,
getver
,
vrepr
,
parse_pycentral_vrange
,
\
get_requested_versions
,
parse_vrange
,
vrange_str
from
debpython.namespace
import
parse
as
parse_nsp
from
debpython.pydist
import
validate
as
validate_pydist
,
\
PUBLIC_DIR_RE
from
debpython.tools
import
sitedir
,
relative_symlink
,
\
...
...
@@ -155,6 +156,7 @@ def share(package, stats, options):
share_2x
(
sitedir
(
srcver
,
package
),
sitedir
(
version
,
package
))
# remove duplicates
stats
[
'
requires.txt
'
]
=
set
(
realpath
(
i
)
for
i
in
stats
[
'
requires.txt
'
])
stats
[
'
nsp.txt
'
]
=
set
(
realpath
(
i
)
for
i
in
stats
[
'
nsp.txt
'
])
def
move_to_pyshared
(
dir1
):
...
...
@@ -291,6 +293,7 @@ def share_2x(dir1, dir2, dc=None):
def
scan
(
package
,
dname
=
None
):
"""
Gather statistics about Python files in given package.
"""
r
=
{
'
requires.txt
'
:
set
(),
'
nsp.txt
'
:
set
(),
'
shebangs
'
:
set
(),
'
public_vers
'
:
set
(),
'
private_dirs
'
:
{},
...
...
@@ -355,8 +358,11 @@ def scan(package, dname=None):
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
'
))
if
root
.
endswith
(
'
.egg-info
'
):
if
'
requires.txt
'
in
file_names
:
r
[
'
requires.txt
'
].
add
(
join
(
root
,
'
requires.txt
'
))
if
'
namespace_packages.txt
'
in
file_names
:
r
[
'
nsp.txt
'
].
add
(
join
(
root
,
'
namespace_packages.txt
'
))
continue
# check files
...
...
@@ -462,6 +468,8 @@ def main():
parser
.
add_option
(
'
--suggests
'
,
action
=
'
append
'
,
dest
=
'
suggests
'
,
help
=
'
translate given requirements into Debian
'
'
dependencies and add them to ${python:Suggests}
'
)
parser
.
add_option
(
'
--namespace
'
,
action
=
'
append
'
,
dest
=
'
namespaces
'
,
help
=
'
recreate __init__.py files for given namespaces at install time
'
)
# ignore some debhelper options:
parser
.
add_option
(
'
-O
'
,
help
=
SUPPRESS_HELP
)
...
...
@@ -590,6 +598,16 @@ def main():
os
.
makedirs
(
dstdir
)
fcopy
(
pydist_file
,
join
(
dstdir
,
package
))
# namespace feature - recreate __init__.py files at install time
nsp
=
parse_nsp
(
pdetails
[
'
nsp.txt
'
],
options
.
namespaces
)
# TODO: skip non-empty __init__.py files, remove empty ones
if
nsp
:
dstdir
=
join
(
'
debian
'
,
package
,
'
usr/share/python/ns/
'
)
if
not
exists
(
dstdir
):
os
.
makedirs
(
dstdir
)
with
open
(
join
(
dstdir
,
package
),
'
w
'
)
as
fp
:
fp
.
writelines
(
"
%s
\n
"
%
i
for
i
in
nsp
)
dh
.
save
()
if
__name__
==
'
__main__
'
:
...
...
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