You are not logged in.

#1 2016-08-07 00:44:13

capoeira
Member
From: Vila Velha - Brasil
Registered: 2010-05-25
Posts: 470

[SOLVED] market-maker

I'm eternal noob on Arch. But afaik I should install everything with pacman.

this is a very simple install. but I just don't know what I have to put in the pkgbuild.
are there any pgkbuilt templates for something like this?

there is only 1 step:

Get dependencies: python setup.py install
This will create a settings.py file at the root.



https://github.com/BitMEX/market-maker

Last edited by capoeira (2016-08-07 22:20:44)

Offline

#2 2016-08-07 06:16:06

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] market-maker

You can take a look at the PKGBUILDs for various python modules as packaged in the repos and AUR.

But the basic idea is pretty simple. I use the following (tweaked for the particular project's name/url/version/license and feel free to replace python with python2):

_pkgname=some-module
pkgname=python-${_pkgname}
pkgver=1.0.0
pkgrel=1
pkgdesc="This is supposed to be a description, edit me!"
arch=('any')
url="https://github.com/authorname/${_pkgname}"
license=('GPL')
depends=('python' 'python-setuptools')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('c90092ca1224cc0501d6bfef3a6ee265181dd85a2f38a8a9db74ebd2aa9e2f45')

build() {
    cd "${srcdir}/${_pkgname}-${pkgver}"
    python setup.py build
}

package() {
    cd "${srcdir}/${_pkgname}-${pkgver}"
    python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}

If the module provides an executable and is not just a module for other projects to import, then there is no need for the ${_pkgname} hack. wink


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2016-08-07 21:12:59

capoeira
Member
From: Vila Velha - Brasil
Registered: 2010-05-25
Posts: 470

Re: [SOLVED] market-maker

I'm a little confused with the build() part. the readme of the package doesn't mention it. and in the package() part it says --skip-build. so is this correct?

pkgname=market-maker
pkgver=0.3
pkgrel=1
pkgdesc="Market making bot for BitMEX API"
arch=('any')
url="https://github.com/BitMEX/${_pkgname}"
license=('GPL')
depends=('python2' 'python2-requests' 'python2-future' 'python2-websocket-client')
source=("https://github.com/BitMEX/market-maker/archive/master.zip")
sha256sums=(36836b6ed9ffb177e8b2750abdce9fa0a87501495308014b4bf852eb45efd456')


build() {
    cd "${srcdir}"
    python setup.py build
}

package() {
    cd "${srcdir}"
    python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}

Offline

#4 2016-08-07 21:43:58

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] market-maker

That is internal setuptools stuff, kind of like the "make" and "make install" targets offered by a typical Makefile. Probably-irrelevant trivia will now follow...

Basically, it separates out the "build_py" and "build_ext" stages of a setuptools-based setup.py installation process, into the PKGBUILD build() function.

build_py will copy the *.py source modules specified in setup.py, into build/lib/, and build_ext will compile python binary extensions into build/lib.linux-${arch}-${py_ver}/
(Technically, if there is a binary extension, the *.py modules go in the same architecture-dependent build folder.)

install depends on build_py and build_ext (whatever exists for that python package) and will copy the lib folder to "${pkgdir}"/usr/lib/python3.5/site-packages/

...

Some would say don't use a build function unless there is a binary component that needs to be compiled, just use `python setup.py install --root="${pkgdir}" --optimize=1` in the package function.
I happen to disagree. wink

...

Yes, that looks mostly fine. Except, I assume from your use of master.zip that the GitHub repository doesn't tag their releases. In that case, you might want to pull a specific commit, or make it a *-git development PKGBUILD, see VCS Packaging Guidelines for more details.
And, you will have to change directories into the extracted zip folder, which is usually ${pkgname}-${_whatever_archive_name}.

So, the PKGBUILD would look like this instead:

pkgname=market-maker
pkgver=0.3
pkgrel=1
pkgdesc="Market making bot for BitMEX API"
arch=('any')
url="https://github.com/BitMEX/${pkgname}"
license=('GPL')
depends=('python2' 'python2-requests' 'python2-future' 'python2-websocket-client')
source=("${url}/archive/master.zip")
sha256sums=(36836b6ed9ffb177e8b2750abdce9fa0a87501495308014b4bf852eb45efd456')


build() {
    cd "${srcdir}/${pkgname}-master"
    python setup.py build
}

package() {
    cd "${srcdir}/${pkgname}-master"
    python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}

Last edited by eschwartz (2016-08-07 22:20:05)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2016-08-07 22:16:35

capoeira
Member
From: Vila Velha - Brasil
Registered: 2010-05-25
Posts: 470

Re: [SOLVED] market-maker

thanks a lot. I could reproduce and learned.

now I only have to find out why I get CLRF characters in my PKGBUILD (copy here, paste in nano), and even after "sed -i 's/^M//' PKGBUILD" I get the error message again.

Offline

#6 2016-08-07 22:25:49

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] market-maker

I can only assume your nano configuration is somehow set to activate dosformat (from the manpage: "When writing a file, switch to writing a DOS format (CR/LF).")


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2016-08-07 22:59:18

capoeira
Member
From: Vila Velha - Brasil
Registered: 2010-05-25
Posts: 470

Re: [SOLVED] market-maker

Eschwartz wrote:

I can only assume your nano configuration is somehow set to activate dosformat (from the manpage: "When writing a file, switch to writing a DOS format (CR/LF).")

something strange happened after I first made the file accidently in Wine Notepad. now it builded. thanks a lot again

Offline

Board footer

Powered by FluxBB