Python wrapper for libalpm and python implementation of pacman (pycman). Backported to Python 2.
61 lines
1.8 KiB
Diff
61 lines
1.8 KiB
Diff
From 7cfc7fd75c2c93085f7426d4f3cc9b893686b0b8 Mon Sep 17 00:00:00 2001
|
|
From: Ray Donnelly <mingw.android@gmail.com>
|
|
Date: Sat, 12 Mar 2016 12:10:52 +0000
|
|
Subject: [PATCH 5/5] Use pkg-config, add LIBALPM_STATIC env. var
|
|
|
|
---
|
|
setup.py | 21 +++++++++++++++++----
|
|
1 file changed, 17 insertions(+), 4 deletions(-)
|
|
|
|
diff --git setup.py setup.py
|
|
index 44507a9..49adf99 100644
|
|
--- setup.py
|
|
+++ setup.py
|
|
@@ -1,6 +1,7 @@
|
|
# -*- coding: utf-8 -*-
|
|
import os
|
|
from distutils.core import Extension, setup
|
|
+import commands
|
|
|
|
os.putenv('LC_CTYPE', 'en_US.UTF-8')
|
|
|
|
@@ -12,11 +13,21 @@ cflags = ['-Wall', '-Wextra',
|
|
'-Wno-unused-function',
|
|
'-Wno-format',
|
|
'-Wdeclaration-after-statement',
|
|
- '-ansi', '-D_FILE_OFFSET_BITS=64']
|
|
+ '-ansi', '-D_FILE_OFFSET_BITS=64',
|
|
+ '-DVERSION="%s"' % pyalpm_version]
|
|
+
|
|
+# From: http://code.activestate.com/recipes/502261-python-distutils-pkg-config/
|
|
+def pkg_config(*pkg_config_flags, **kw):
|
|
+ flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
|
|
+ kw['extra_compile_args'] = cflags
|
|
+ for token in commands.getoutput("pkg-config --libs --cflags %s" % ' '.join(pkg_config_flags)).split():
|
|
+ if token[:2] in flag_map:
|
|
+ kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
|
|
+ else:
|
|
+ kw['extra_compile_args'].append(token)
|
|
+ return kw
|
|
|
|
alpm = Extension('pyalpm',
|
|
- libraries = ['alpm'],
|
|
- extra_compile_args = cflags + ['-DVERSION="%s"' % pyalpm_version],
|
|
language = 'C',
|
|
sources = [
|
|
'src/pyalpm.c',
|
|
@@ -34,7 +45,9 @@ alpm = Extension('pyalpm',
|
|
'src/package.h',
|
|
'src/pyalpm.h',
|
|
'src/util.h',
|
|
- ])
|
|
+ ],
|
|
+ **pkg_config('libalpm', '--static' if os.getenv('LIBALPM_STATIC') else '')
|
|
+ )
|
|
|
|
setup(name = 'pyalpm',
|
|
version = pyalpm_version,
|
|
--
|
|
2.7.1
|
|
|