Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
abuild
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
13
Issues
13
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
abuild
Commits
6310405a
Commit
6310405a
authored
Aug 04, 2019
by
Timothy Legge
Committed by
Natanael Copa
Aug 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apkbuild-pypi.in: fix bugs, upgrade for python3 only and add to make
parent
0d4bb950
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
21 deletions
+33
-21
Makefile
Makefile
+1
-1
apkbuild-pypi.in
apkbuild-pypi.in
+32
-20
No files found.
Makefile
View file @
6310405a
...
...
@@ -9,7 +9,7 @@ datadir ?= $(prefix)/share/$(PACKAGE)
mandir
?=
$(prefix)
/share/man
SCRIPTS
:=
abuild abuild-keygen abuild-sign newapkbuild
\
abump apkgrel buildlab apkbuild-cpan checkapk
\
abump apkgrel buildlab apkbuild-cpan
apkbuild-pypi
checkapk
\
apkbuild-gem-resolver
USR_BIN_FILES
:=
$(SCRIPTS)
abuild-tar abuild-gzsplit abuild-sudo abuild-fetch abuild-rmtemp
MAN_1_PAGES
:=
newapkbuild.1
...
...
apkbuild-pypi.in
View file @
6310405a
...
...
@@ -13,36 +13,40 @@ my %pkgmap = ();
my
%
licenses
=
();
my
$template
=
<<'EOF';
# Contributor: [% contributor %]
# Maintainer: [% maintainer %]
[% authors %]
pkgname=[% pkgname %]
_pkgreal=[% pkgreal %]
pkgver=[% pkgver %]
pkgrel=0
pkgdesc=
[% pkgdesc %]
pkgdesc=
"[% pkgdesc %]"
url="http://packages.python.org/pypi/[% pkgreal %]"
arch="noarch"
license="
PSF
"
license="
[% license %]
"
pydepends=""
pymakedepends=""
depends="python $pydepends"
makedepends="python-dev $pymakedepends"
subpackages="$pkgname-doc"
depends="python3 $pydepends"
checkdepends="python3-dev"
makedepends="py3-setuptools $pymakedepends"
subpackages=""
source="[% source %]"
builddir="$srcdir/$_pkgreal-$pkgver"
build() {
cd "$builddir"
python setup.py build
python3 setup.py build
}
package() {
cd "$builddir"
python setup.py install \
PYTHONPATH=$pkgdir`python3 -c "import site; print(site.getsitepackages()[0])"` \
python
3
setup.py install \
--prefix=/usr \
--root="$pkgdir" \
--single-version-externally-managed
}
check() {
python3 setup.py test
}
EOF
my
$ua
=
LWP::
UserAgent
->
new
();
...
...
@@ -60,19 +64,22 @@ sub read_file {
sub
read_assignments_from_file
{
my
(
$filename
)
=
@_
;
return
()
if
(
!
-
e
$filename
);
my
$text
=
read_file
(
$filename
);
my
%
sline
=
$text
=~
/^(\w+)\s*=\s*([^\"\n]*)$/mg
;
my
%
mline
=
$text
=~
/^(\w+)\s*=\s*\"([^\"]*)\"$/mg
;
my
%
hash
=
(
%
sline
,
%
mline
);
my
%
temp
=
(
%
sline
,
%
mline
);
my
$authors
=
join
("
\n
",
$text
=~
/^# Contributor: .*$/mg
,
$text
=~
/^# Maintainer: .*$/mg
);
$hash
{'
authors
'}
=
$authors
if
length
(
$authors
)
>
1
;
return
\%
temp
;
return
\%
hash
;
}
sub
map_pypi_to_apk
{
my
(
$pypi
)
=
@_
;
return
$pkgmap
{
$pypi
}
unless
!
exists
(
$pkgmap
{
$pypi
});
return
'
py-
'
.
lc
(
$pypi
);
return
'
py
3
-
'
.
lc
(
$pypi
);
}
sub
map_license
{
...
...
@@ -97,15 +104,16 @@ sub read_apkbuild {
}
sub
write_apkbuild
{
my
(
$distdata
)
=
@_
;
my
(
$distdata
,
$authors
)
=
@_
;
my
%
repl
=
(
packager
=>
$packager
,
authors
=>
(
$authors
or
"
# Contributor:
$packager
\n
# Maintainer:
$packager
")
,
pkgname
=>
map_pypi_to_apk
(
$distdata
->
{
info
}{
name
}),
pkgreal
=>
$distdata
->
{
info
}{
name
},
pkgver
=>
$distdata
->
{
info
}{
version
},
source
=>
get_source
(
$distdata
),
license
=>
map_license
(
$distdata
->
{
info
}{
license
}),
pkgdesc
=>
$distdata
->
{
info
}{
summary
},
);
$template
=~
s/\[% (.*?) %\]/$repl{$1}/g
;
...
...
@@ -124,7 +132,7 @@ sub prepare_tree {
sub
get_data
{
my
(
$package
)
=
@_
;
my
$response
=
$ua
->
get
("
http://pypi.python.org/pypi/
$package
/json
");
my
$response
=
$ua
->
get
("
http
s
://pypi.python.org/pypi/
$package
/json
");
$response
->
is_success
or
die
$response
->
status_line
;
my
$distdata
=
$json
->
decode
(
$response
->
decoded_content
);
...
...
@@ -135,7 +143,7 @@ sub get_deps {
my
(
$data
)
=
@_
;
chdir
"
src/
$data
->{pkgreal}-
$data
->{pkgver}
";
my
$reqs
=
`
python ./setup.py --requires
`;
my
$reqs
=
`
python
3
./setup.py --requires
`;
my
@reqs
=
split
/\n/
,
$reqs
;
...
...
@@ -162,6 +170,9 @@ sub get_deps {
my
$abuild_conf
=
read_assignments_from_file
('
/etc/abuild.conf
');
$packager
=
$abuild_conf
->
{
PACKAGER
}
if
$abuild_conf
->
{
PACKAGER
};
my
$user_abuild_conf
=
read_assignments_from_file
(
$ENV
{"
HOME
"}
.
"
/.abuild/abuild.conf
");
$packager
=
$user_abuild_conf
->
{
PACKAGER
}
if
$user_abuild_conf
->
{
PACKAGER
};
sub
usage
{
say
<<'EOF';
Usage: apkbuild-pypi [create <package> | check | recreate | upgrade | update]
...
...
@@ -188,16 +199,17 @@ given ($ARGV[0]) {
mkdir
$apkname
;
chdir
$apkname
;
my
$data
=
write_apkbuild
(
$distdata
);
my
$data
=
write_apkbuild
(
$distdata
,
undef
);
prepare_tree
;
get_deps
(
$data
);
}
when
('
recreate
')
{
my
$apkbuild
=
read_apkbuild
;
my
$distdata
=
get_data
(
$apkbuild
->
{
_pkgreal
});
my
$data
=
write_apkbuild
(
$distdata
,
$apkbuild
->
{
authors
});
prepare_tree
;
get_deps
;
get_deps
(
$data
)
;
}
when
('
upgrade
')
{
my
$apkbuild
=
read_apkbuild
;
my
$distdata
=
get_data
(
$apkbuild
->
{
_pkgreal
});
...
...
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