MSYS2-packages/python-pyalpm/0005-Use-pkg-config-add-LIBALPM_STATIC-env.-var.patch
Christoph Reiter 6d4b3577b4
Python 2 Removal - Round 1 (#1866)
* gpgme: Drop the Python 2 package

* dtc: Build with Python 3

The package in the repo is already build using Python 3, so this basically
just fixes the dependency list.

* Drop jhbuild-git

This is a really old version and upstream doesn't target cygwin, so just drop it.

* python-colorama: Drop Python 2 package

* python-mako: Drop Python 2 package

* python-pyalpm: Update to 0.9.1 and drop Python 2 package

0.8 did no longer build with the current pacman so I had to update
as well to drop Python 2.

* python-pygments: Drop Python 2 package

* python2-pathlib: Remove package

Unused

* python2-scandir: Remove package

Unused

* python-beaker: Drop Python 2 package

* python-markupsafe: Drop Python 2 package

* python-mock: Drop Python 2 package

* python2-funcsigs: Remove package

Unused

* python-nose: Drop Python 2 package

Also adds a conflict with python2-nose because the man pages and
main script got moved to the Python 3 package.

* python2-unittest2: Remove package

Unused

* python2-traceback2: Remove package

Unused

* python2-linecache2: Remove package

Unused

* python-pbr: Drop Python 2 package
2020-02-24 10:40:03 +03:00

51 lines
2.1 KiB
Diff

--- pyalpm/setup.py.orig 2020-02-23 16:10:00.163976600 +0100
+++ pyalpm/setup.py 2020-02-23 16:12:27.525811500 +0100
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import os
from setuptools import setup, Extension
+import subprocess
os.putenv('LC_CTYPE', 'en_US.UTF-8')
@@ -9,15 +10,25 @@
PYCMAN_SCRIPTS = ['database', 'deptest', 'query', 'remove', 'sync', 'upgrade', '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 subprocess.check_output(("pkg-config --libs --cflags %s" % ' '.join(pkg_config_flags)).split()).decode('ascii').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
+
if __name__ == "__main__":
cflags = ['-Wall', '-Wextra', '-Werror',
'-Wno-unused-parameter', '-Wno-incompatible-pointer-types',
- '-Wno-cast-function-type', '-std=c99', '-D_FILE_OFFSET_BITS=64']
+ '-Wno-cast-function-type', '-Wno-unused-function', '-Wno-strict-aliasing', '-std=c99', '-D_FILE_OFFSET_BITS=64',
+ '-DVERSION="%s"' % pyalpm_version]
alpm = Extension('pyalpm',
- libraries=['alpm'],
- extra_compile_args=cflags + ['-DVERSION="%s"' % pyalpm_version],
language='C',
sources=['src/pyalpm.c',
'src/util.c',
@@ -31,7 +42,9 @@
'src/options.h',
'src/package.h',
'src/pyalpm.h',
- 'src/util.h'])
+ 'src/util.h'],
+ **pkg_config('libalpm', '--static' if os.getenv('LIBALPM_STATIC') else '')
+ )
with open("README.md", "r") as fh:
long_description = fh.read()