[python] Use distutils to compile and install pygmi/pyxp.

This commit is contained in:
Kris Maglione 2010-06-27 17:47:45 -04:00
parent a5ca791958
commit c629223ec9
15 changed files with 203 additions and 95 deletions

View File

@ -14,3 +14,5 @@ syntax: glob
config.local.mk config.local.mk
cmd/menu/bindings.c cmd/menu/bindings.c
*.pkg.tar.?z *.pkg.tar.?z
alternative_wmiircs/python/build/
alternative_wmiircs/python/dist/

5
NEWS
View File

@ -1,15 +1,16 @@
3.10b1: 3.10b1:
* Xft is now loaded on demand.
* /colrules widths may now be specified in pixels. * /colrules widths may now be specified in pixels.
* /tagrules has been replaced with the more general /rules * /tagrules has been replaced with the more general /rules
* The format of the bar files has changed.
* Add witray system tray program. * Add witray system tray program.
* Floating clients can be collapsed by clicking their layout boxes. * Floating clients can be collapsed by clicking their layout boxes.
* Dock windows act more like dock windows. * Dock windows act more like dock windows.
* Fixed some managed move bugs.
* The FocusFloating and FocusColumn events have been removed. * The FocusFloating and FocusColumn events have been removed.
* The tag '!' is no longer special. * The tag '!' is no longer special.
* Xft is now loaded on demand.
3.9.2: 3.9.2:
* Fixed some managed move bugs.
* Work around mawk bug that broke wmiirc. * Work around mawk bug that broke wmiirc.
3.9.1: 3.9.1:

View File

@ -1,34 +1,53 @@
pkgname=wmii-hg pkgname=(wmii-hg pyxp-hg pygmi-hg)
pkgver=2740 pkgver=2746
pkgrel=1 pkgrel=1
pkgdesc="The latest hg pull of wmii, a lightweight, dynamic window manager for X11" pkgdesc="The latest hg pull of wmii, a lightweight, dynamic window manager for X11"
url="http://wmii.suckless.org" url="http://wmii.suckless.org"
license=(MIT) license=(MIT)
arch=(i686 x86_64) arch=(i686 x86_64)
depends=(libx11 libxinerama libxrandr) makedepends=(mercurial python "libixp-hg>="$(sed -rn <mk/wmii.mk 's/.*IXP_NEEDAPI=([0-9]+).*/\1/p'))
makedepends=(mercurial "libixp-hg>="$(sed -rn <mk/wmii.mk 's/.*IXP_NEEDAPI=([0-9]+).*/\1/p')) options=(!strip)
optdepends=("plan9port: for use of the alternative plan9port wmiirc" \
"python: for use of the alternative Python wmiirc" \
"ruby-rumai: for use of the alternative Ruby wmiirc" \
"libxft: for anti-aliased font support")
provides=(wmii)
conflicts=(wmii)
source=() source=()
FORCE_VER=$(hg log -r . --template {rev}) FORCE_VER=$(hg log -r . --template {rev})
build() _make() {
{
cd $startdir cd $startdir
flags=(PREFIX=/usr \ make PREFIX=/usr \
PYPREFIX=--prefix=/usr \
ETC=/etc \ ETC=/etc \
DESTDIR="$pkgdir") DESTDIR="$pkgdir" \
"$@"
}
make "${flags[@]}" || return 1 build() {
make "${flags[@]}" install || return 1 _make "${flags[@]}" || return 1
}
package_wmii-hg() {
depends=(libx11 libxinerama libxrandr)
optdepends=("plan9port: for use of the alternative plan9port wmiirc" \
"pygmi: for use of the alternative Python wmiirc" \
"ruby-rumai: for use of the alternative Ruby wmiirc" \
"libxft: for anti-aliased font support")
provides=(wmii)
conflicts=(wmii)
_make install PYMODULES= || return 1
install -m644 -D ./debian/file/wmii.desktop "$pkgdir/etc/X11/sessions/wmii.desktop" install -m644 -D ./debian/file/wmii.desktop "$pkgdir/etc/X11/sessions/wmii.desktop"
install -m644 -D ./LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" install -m644 -D ./LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
} }
package_pyxp-hg() {
arch=(any)
depends=(python)
_make -C alternative_wmiircs/python pyclean pyxp.install
}
package_pygmi-hg() {
arch=(any)
depends=(pyxp-hg)
_make -C alternative_wmiircs/python pyclean pygmi.install
}

View File

@ -1,4 +1,5 @@
#!/bin/sh -f #!/bin/sh -f
test $#* '=' 0 || {
p="$PATH" p="$PATH"
which rc >/dev/null || PATH="$PLAN9:$p" which rc >/dev/null || PATH="$PLAN9:$p"
which rc >/dev/null || PATH="/usr/local/plan9/bin:$p" which rc >/dev/null || PATH="/usr/local/plan9/bin:$p"
@ -7,7 +8,8 @@ which rc >/dev/null || PATH="/opt/plan9/bin:$p"
which rc >/dev/null || PATH="/opt/9/bin:$p" which rc >/dev/null || PATH="/opt/9/bin:$p"
which rc >/dev/null || PATH="/usr/plan9/bin:$p" which rc >/dev/null || PATH="/usr/plan9/bin:$p"
which rc >/dev/null || PATH="/usr/9/bin:$p" which rc >/dev/null || PATH="/usr/9/bin:$p"
test $#* '=' 0 || exec rc $0 exec rc $0
}
cd cd
scriptname=$0 scriptname=$0
@ -30,8 +32,8 @@ noticebar=/rbar/!notice
# Theme # Theme
wmiifont='drift,-*-fixed-*-*-*-*-9-*-*-*-*-*-*-*' wmiifont='drift,-*-fixed-*-*-*-*-9-*-*-*-*-*-*-*'
wmiifont='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*' wmiifont='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
wmiinormcol=`{echo '#000000 #c1c48b #81654f'} wmiinormcol=('#000000' '#c1c48b' '#81654f')
wmiifocuscol=`{echo '#000000 #81654f #000000'} wmiifocuscol=('#000000' '#81654f' '#000000')
wmiibackground='#333333' wmiibackground='#333333'
wmiifloatbackground='#222222' wmiifloatbackground='#222222'
fn setbackground { xsetroot -solid $* } fn setbackground { xsetroot -solid $* }
@ -191,9 +193,8 @@ fn key {
key=() key=()
for(k) { for(k) {
if(! ~ $k $_keys) { if(! ~ $k $_keys) {
ifs=() { wmiikeyhelp = `{awk 'BEGIN { ifs=() { wmiikeyhelp = `{
printf "%s %- 20s %s\n", ENVIRON["wmiikeyhelp"], ENVIRON["k"], ENVIRON["help"] printf "%s %- 20s %s\n" $wmiikeyhelp $k $help}}
exit }'} }
key = ($key Key-$k)}} key = ($key Key-$k)}}
~ $#key 0} ~ $#key 0}

View File

@ -2,13 +2,13 @@ ROOT=../..
include $(ROOT)/mk/hdr.mk include $(ROOT)/mk/hdr.mk
include $(ROOT)/mk/wmii.mk include $(ROOT)/mk/wmii.mk
PYMODULES = pyxp pygmi
DOCS = README DOCS = README
EXECS = wmiirc EXECS = wmiirc
TEXT = wmiirc.py TEXT = wmiirc.py
DIRS = pygmi \
pyxp
DIR = $(GLOBALCONF)/python DIR = $(GLOBALCONF)/python
DOCDIR = $(DOC)/alternative_wmiircs/python DOCDIR = $(DOC)/alternative_wmiircs/python
include $(ROOT)/mk/dir.mk include $(ROOT)/mk/python.mk

View File

@ -0,0 +1,14 @@
#!/usr/bin/env python
from distutils.core import setup
setup(name='pygmi',
version='0.2',
description='Python wmii interaction library',
author='Kris Maglione',
author_email='maglione.k@gmail.com',
url='http://wmii.suckless.org',
packages=['pygmi'],
license='MIT',
)

View File

@ -28,11 +28,27 @@ class Never(Toggle.__class__):
pass pass
def constrain(min, max, val): def constrain(min, max, val):
if val < min: return min if val < min else max if val > max else val
return min
if val > max: class Map(collections.Mapping):
return max def __init__(self, cls, *args):
return val self.cls = cls
self.args = args
def __repr__(self):
return 'Map(%s%s)' % (self.cls.__name__, (', %s' % ', '.join(map(repr, self.args)) if self.args else ''))
def __getitem__(self, item):
ret = self.cls(*(self.args + (item,)))
if not ret.exists:
raise KeyError('no such %s %s' % (self.cls.__name__.lower(), repr(item)))
return ret
def __len__(self):
return len(iter(self))
def __keys__(self):
return [v for v in self.cls.all(*self.args)]
def __iter__(self):
return (v for v in self.cls.all(*self.args))
def iteritems(self):
return ((v, self.cls(*(self.args + (v,)))) for v in self.cls.all(*self.args))
class Ctl(object): class Ctl(object):
""" """
@ -65,7 +81,13 @@ class Ctl(object):
""" """
Arguments are joined by ascii spaces and written to the ctl file. Arguments are joined by ascii spaces and written to the ctl file.
""" """
client.awrite(self.ctl_path, u' '.join(map(unicode, args))) def next(file, exc=None, tb=None):
if file:
self.file = file
file.awrite(u' '.join(map(unicode, args)))
if self.file:
return next(file)
client.acreate(self.ctl_path, callback=next, mode=OWRITE)
def __getitem__(self, key): def __getitem__(self, key):
for line in self.ctl_lines(): for line in self.ctl_lines():
@ -128,7 +150,7 @@ class Ctl(object):
@prop(doc="If #ctl_hasid is set, returns the id of this ctl file.") @prop(doc="If #ctl_hasid is set, returns the id of this ctl file.")
def id(self): def id(self):
if self._id is None and self.ctl_hasid: if self._id is None and self.ctl_hasid:
return client.read(self.ctl_path).split('\n', 1)[0] return self.name_read(client.read(self.ctl_path).split('\n', 1)[0])
return self._id return self._id
class Dir(Ctl): class Dir(Ctl):
@ -140,6 +162,8 @@ class Dir(Ctl):
represented by this class reside. e.g., /client, /tag represented by this class reside. e.g., /client, /tag
""" """
ctl_hasid = True ctl_hasid = True
name_read = unicode
name_write = unicode
def __init__(self, id): def __init__(self, id):
""" """
@ -154,7 +178,7 @@ class Dir(Ctl):
if isinstance(id, Dir): if isinstance(id, Dir):
id = id.id id = id.id
if id != 'sel': if id != 'sel':
self._id = id self._id = self.name_read(id)
def __eq__(self, other): def __eq__(self, other):
return (self.__class__ == other.__class__ and return (self.__class__ == other.__class__ and
@ -218,16 +242,22 @@ class Dir(Ctl):
@prop(doc="The path to this directory") @prop(doc="The path to this directory")
def path(self): def path(self):
return '%s/%s' % (self.base_path, self._id or 'sel') return '%s/%s' % (self.base_path, self.name_write(self._id or 'sel'))
@prop(doc="True if the given object exists in the wmii filesystem")
def exists(self):
return bool(client.stat(self.path))
@classmethod @classmethod
def all(cls): def all(cls):
""" """
Returns all of the objects that exist for this type of directory. Returns all of the objects that exist for this type of directory.
""" """
return (cls(s.name) return (cls.name_read(s.name)
for s in client.readdir(cls.base_path) for s in client.readdir(cls.base_path)
if s.name != 'sel') if s.name != 'sel')
@classmethod
def map(cls, *args):
return Map(cls, *args)
def __repr__(self): def __repr__(self):
return '%s(%s)' % (self.__class__.__name__, return '%s(%s)' % (self.__class__.__name__,
@ -243,6 +273,15 @@ class Client(Dir):
'group': (lambda s: int(s, 16), str), 'group': (lambda s: int(s, 16), str),
'pid': (int, None), 'pid': (int, None),
} }
@staticmethod
def name_read(name):
if isinstance(name, int):
return name
try:
return int(name, 16)
except:
return unicode(name)
name_write = lambda self, name: name if isinstance(name, basestring) else '%#x' % name
allow = Dir.ctl_property('allow') allow = Dir.ctl_property('allow')
fullscreen = Dir.toggle_property('fullscreen') fullscreen = Dir.toggle_property('fullscreen')
@ -531,6 +570,7 @@ class Button(Ctl):
self.base_path = self.sides[side] self.base_path = self.sides[side]
self.ctl_path = '%s/%s' % (self.base_path, self.name) self.ctl_path = '%s/%s' % (self.base_path, self.name)
self.file = None self.file = None
if colors or label:
self.create(colors, label) self.create(colors, label)
def create(self, colors=None, label=None): def create(self, colors=None, label=None):
@ -548,11 +588,18 @@ class Button(Ctl):
self.file.aremove() self.file.aremove()
self.file = None self.file = None
@property
def exists(self):
return bool(self.file and File.stat(self.file))
@classmethod @classmethod
def all(cls, side): def all(cls, side):
return (Button(side, s.name) return (s.name
for s in client.readdir(cls.sides[side]) for s in client.readdir(cls.sides[side])
if s.name != 'sel') if s.name != 'sel')
@classmethod
def map(cls, *args):
return Map(cls, *args)
class Rules(collections.MutableMapping, utf8): class Rules(collections.MutableMapping, utf8):
@ -586,8 +633,7 @@ class Rules(collections.MutableMapping, utf8):
def __len__(self): def __len__(self):
return len(tuple(self.iteritems())) return len(tuple(self.iteritems()))
def __iter__(self): def __iter__(self):
for k, v in self.iteritems(): return (k for k, v in self.iteritems())
yield k
def __list__(self): def __list__(self):
return list(iter(self)) return list(iter(self))
def __tuple__(self): def __tuple__(self):
@ -609,8 +655,7 @@ class Rules(collections.MutableMapping, utf8):
return u''.join(unicode(value) for (key, value) in self.iteritems()) or u'\n' return u''.join(unicode(value) for (key, value) in self.iteritems()) or u'\n'
def iteritems(self): def iteritems(self):
for item in self._items: return iter(self._items)
yield item
def items(self): def items(self):
return list(self._items()) return list(self._items())
@ -659,8 +704,7 @@ class Rule(collections.MutableMapping, utf8):
def __len__(self): def __len__(self):
return len(self._items) return len(self._items)
def __iter__(self): def __iter__(self):
for k in iter(self._items): return iter(self._items)
yield k
def __list__(self): def __list__(self):
return list(iter(self)) return list(iter(self))
def __tuple__(self): def __tuple__(self):
@ -687,8 +731,7 @@ class Rule(collections.MutableMapping, utf8):
for (k, v) in self.iteritems())) for (k, v) in self.iteritems()))
def iteritems(self): def iteritems(self):
for i in self._items: return iter(self._items)
yield i
def items(self): def items(self):
return list(self._items) return list(self._items)
@ -702,10 +745,10 @@ class wmii(Ctl):
'border': (int, str), 'border': (int, str),
} }
clients = property(lambda self: Client.all()) clients = Client.map()
tags = property(lambda self: Tag.all()) tags = Tag.map()
lbuttons = property(lambda self: Button.all('left')) lbuttons = Button.map('left')
rbuttons = property(lambda self: Button.all('right')) rbuttons = Button.map('right')
rules = Rules('/rules') rules = Rules('/rules')

View File

@ -0,0 +1,14 @@
#!/usr/bin/env python
from distutils.core import setup
setup(name='pyxp',
version='0.2',
description='Python 9P client library',
author='Kris Maglione',
author_email='maglione.k@gmail.com',
url='http://wmii.suckless.org',
packages=['pyxp'],
license='MIT',
)

View File

@ -202,7 +202,7 @@ class Client(object):
try: try:
with self._walk(path) as fid: with self._walk(path) as fid:
resp = self._dorpc(fcall.Tstat(fid= fid)) resp = self._dorpc(fcall.Tstat(fid= fid))
st = resp.stat() st = resp.stat
self._clunk(fid) self._clunk(fid)
return st return st
except RPCError: except RPCError:
@ -328,7 +328,10 @@ class File(object):
def close(self): def close(self):
assert not self.closed assert not self.closed
self.closed = True self.closed = True
try:
self._cleanup() self._cleanup()
except:
pass
self.tg = None self.tg = None
self.fid = None self.fid = None
self.client = None self.client = None
@ -338,9 +341,6 @@ class File(object):
try: try:
self._dorpc(fcall.Tremove()) self._dorpc(fcall.Tremove())
finally: finally:
try:
self.close() self.close()
except Exception:
pass
# vim:se sts=4 sw=4 et: # vim:se sts=4 sw=4 et:

View File

@ -1,9 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python
import os, sys
path = []
for p in os.environ.get("WMII_CONFPATH", "").split(':'):
path += [p, p + '/python']
sys.path = path + sys.path
from pygmi import events from pygmi import events
import wmiirc import wmiirc

View File

@ -8,6 +8,7 @@ PREFIX = /usr/local
ETC = $(PREFIX)/etc ETC = $(PREFIX)/etc
LIBDIR = $(PREFIX)/lib LIBDIR = $(PREFIX)/lib
INCLUDE = $(PREFIX)/include INCLUDE = $(PREFIX)/include
PYPREFIX = --prefix=$(PREFIX)
# Includes and libs # Includes and libs
INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include
@ -26,6 +27,8 @@ LD = cc
# Archiver # Archiver
AR = ar crs AR = ar crs
PYTHON = python
X11PACKAGES = x11 xinerama xrender xrandr X11PACKAGES = x11 xinerama xrender xrandr
INCX11 = $$(pkg-config --cflags $(X11PACKAGES)) INCX11 = $$(pkg-config --cflags $(X11PACKAGES))
LIBIXP = $(LIBDIR)/libixp.a LIBIXP = $(LIBDIR)/libixp.a

View File

@ -22,12 +22,12 @@ FILTER = cat
EXCFLAGS = $(INCLUDES) -D_XOPEN_SOURCE=600 EXCFLAGS = $(INCLUDES) -D_XOPEN_SOURCE=600
COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES)) COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS)
COMPILE = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS)" COMPILE = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS)"
COMPILEPIC = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS) $(SOCFLAGS)" COMPILEPIC = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS) $(SOCFLAGS)"
LINK = $(SHELL) $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(LDFLAGS) $(LIBS)" LINK = $(SHELL) $(ROOT)/util/link "$(LD)" "$(PACKAGES)" "$(LDFLAGS) $(LIBS)"
LINKSO = $(SHELL) $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(SOLDFLAGS) $(LIBS) $(SHARED)" LINKSO = $(SHELL) $(ROOT)/util/link "$(LD)" "$(PACKAGES)" "$(SOLDFLAGS) $(LIBS) $(SHARED)"
CLEANNAME=$(SHELL) $(ROOT)/util/cleanname CLEANNAME=$(SHELL) $(ROOT)/util/cleanname
@ -36,7 +36,7 @@ TAGFILES=
CTAGS=ctags CTAGS=ctags
PACKAGES = 2>/dev/null PACKAGES =
# and this: # and this:
# Try to find a sane shell. /bin/sh is a last resort, because it's # Try to find a sane shell. /bin/sh is a last resort, because it's
@ -56,14 +56,13 @@ MKCFG!=$(MKCFGSH)
include $(MKCFG) include $(MKCFG)
.SILENT: .SILENT:
.SUFFIXES: .out .o .o_pic .c .pdf .sh .rc .$(SOEXT) .awk .1 .3 .man1 .man3 .depend .install .uninstall .clean .SUFFIXES: .$(SOEXT) .1 .3 .awk .build .c .clean .depend .install .man1 .man3 .o .o_pic .out .pdf .py .rc .sh .uninstall
all: all:
MAKEFILES=.depend MAKEFILES=.depend
.c.depend: .c.depend:
echo MKDEP $< echo MKDEP $<
[ -n "$(noisycc)" ] && echo $(MKDEP) $(COMPILE_FLAGS) $< || true $(DEBUG) eval "$(MKDEP) $(COMPILE_FLAGS)" $< | sed '1s|.*:|$(<:%.c=%.o):|' >>.depend
eval "$(MKDEP) $(COMPILE_FLAGS)" $< | sed '1s|.*:|$(<:%.c=%.o):|' >>.depend
.sh.depend .rc.depend .1.depend .3.depend .awk.depend: .sh.depend .rc.depend .1.depend .3.depend .awk.depend:
: :
@ -83,33 +82,30 @@ MAKEFILES=.depend
echo FILTER $(BASE)$< echo FILTER $(BASE)$<
[ -n "$(<:%.sh=)" ] || $(BINSH) -n $< [ -n "$(<:%.sh=)" ] || $(BINSH) -n $<
set -e; \ set -e; \
[ -n "$(noisycc)" ] && set -x; \ $(DEBUG) $(FILTER) $< >$@; \
$(FILTER) $< >$@; \ $(DEBUG) chmod 0755 $@
chmod 0755 $@
.man1.1 .man3.3: .man1.1 .man3.3:
echo TXT2TAGS $(BASE)$< echo TXT2TAGS $(BASE)$<
[ -n "$(noisycc)" ] && set -x; \ $(DEBUG) txt2tags -o- $< >$@
txt2tags -o- $< >$@
DEBUG = _debug() { [ -n "$$noisycc" ] && echo >&2 $$@ || true; "$$@"; }; _debug
INSTALL= _install() { set -e; \ INSTALL= _install() { set -e; \
dashb=$$1; [ $$1 = -b ] && shift; \ dashb=$$1; [ $$1 = -b ] && shift; \
d=$(DESTDIR)$$3; f=$$d/$$(basename $$4); \ d=$(DESTDIR)$$3; f=$$d/$$(basename $$4); \
if [ ! -d $$d ]; then echo MKDIR $$3; mkdir -p $$d; fi; \ if [ ! -d $$d ]; then echo MKDIR $$3; mkdir -p $$d; fi; \
echo INSTALL $$($(CLEANNAME) $(BASE)$$2); \ echo INSTALL $$($(CLEANNAME) $(BASE)$$2); \
[ -n "$(noisycc)" ] && set -x; \ $(DEBUG) rm -f $$f; \
rm -f $$f; \
if [ "$$dashb" = -b ]; \ if [ "$$dashb" = -b ]; \
then cp -f $$2 $$f; \ then $(DEBUG) cp -f $$2 $$f; \
else $(FILTER) <$$2 >$$f; \ else $(DEBUG) $(FILTER) <$$2 >$$f; \
fi; \ fi; \
chmod $$1 $$f; \ $(DEBUG) chmod $$1 $$f; \
set +x; \
}; _install }; _install
UNINSTALL= _uninstall() { set -e; \ UNINSTALL= _uninstall() { set -e; \
echo UNINSTALL $$($(CLEANNAME) $(BASE)$$1); \ echo UNINSTALL $$($(CLEANNAME) $(BASE)$$1); \
[ -n "$(noisycc)" ] && set -x; \ $(DEBUG) rm -f $(DESTDIR)$$2/$$(basename $$3); \
rm -f $(DESTDIR)$$2/$$(basename $$3); \
}; _uninstall }; _uninstall
.out.install: .out.install:

14
mk/python.mk Normal file
View File

@ -0,0 +1,14 @@
# all: pybuild
install: $(PYMODULES:%=%.install)
clean: pyclean
.py.install:
echo PYTHON install $* $(PYPREFIX)
DESTDIR=$(DESTDIR); \
$(DEBUG) $(PYTHON) $< install -cO1 --root=$${DESTDIR:-/} $(PYPREFIX)
pyclean:
echo CLEAN build/
rm -rf build
.PHONY: pybuild pyclean

View File

@ -1,7 +1,10 @@
#!/bin/sh -f #!/bin/sh -f
CC=$1 CC=$1
CFLAGS=$2; shift 2 PACKAGES=$2
CFLAGS=$3; shift 3
[ -n "$PACKAGES" ] && CFLAGS="$CFLAGS $(pkg-config --cflags $PACKAGES)"
outfile="$1"; shift outfile="$1"; shift
bin="$(echo $0 | sed 's,/[^/]*$,,')" bin="$(echo $0 | sed 's,/[^/]*$,,')"

View File

@ -1,7 +1,10 @@
#!/bin/sh -f #!/bin/sh -f
LD=$1 LD=$1
LDFLAGS=$2; shift 2 PACKAGES=$2
LDFLAGS=$3; shift 3
[ -n "$PACKAGES" ] && LDFLAGS="$(pkg-config --libs $PACKAGES) $LDFLAGS"
outfile="$1"; shift outfile="$1"; shift
bin="$(echo $0 | sed 's,/[^/]*$,,')" bin="$(echo $0 | sed 's,/[^/]*$,,')"