Skip to content

Commit

Permalink
This wasn's working anymore, made a few changes, compiles with Python…
Browse files Browse the repository at this point in the history
… 3.10.1
  • Loading branch information
benwah committed Jan 11, 2022
1 parent 56d735d commit cda4671
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
from urllib2 import urlopen


def relative_path(*parts):
return os.path.join('.', *parts)


DWM_VERSION = '6.2'
DWM_SRC_ROOT_DIR= os.path.join('dwm_src')
DWM_SRC_ROOT_DIR= relative_path('dwm_src')
DWM_REMOTE_SOURCE = (
'https://dl.suckless.org/dwm/dwm-{version}.tar.gz'.format(
version=DWM_VERSION
Expand All @@ -26,26 +30,15 @@
DWM_MD5 = '9929845ccdec4d2cc191f16210dd7f3d'


class DwmExtension(Extension):
def __init__(self, *args, **kwargs):
super(DwmExtension, self).__init__(*args, **kwargs)

def set_dwm_options(self, dwm_version):
self.define_macros=[
('_DEFAULT_SOURCE',),
('_BSD_SOURCE',),
('_POSIX_C_SOURCE', 2),
('VERSION', '"{version}"'.format(version=dwm_version)),
('XINERAMA',),
]


def relative_path(*parts):
return os.path.join(os.path.dirname(__file__), *parts)


dwm = DwmExtension(
dwm = Extension(
'dwm',
define_macros=[
('_DEFAULT_SOURCE',),
('_BSD_SOURCE',),
('_POSIX_C_SOURCE', 2),
('VERSION', '"{version}"'.format(version=DWM_VERSION)),
('XINERAMA',),
],
libraries=['X11', 'Xinerama', 'fontconfig', 'Xft'],
library_dirs=['/usr/X11R6/lib'],
extra_compile_args=[
Expand All @@ -62,12 +55,12 @@ def relative_path(*parts):
include_dirs=[
'/usr/X11R6/include',
'/usr/include/freetype2',
relative_path(DWM_SRC_ROOT_DIR),
DWM_SRC_ROOT_DIR,
],
sources=[
relative_path(DWM_SRC_ROOT_DIR, 'drw.c'),
relative_path(DWM_SRC_ROOT_DIR, 'dwm.c'),
relative_path(DWM_SRC_ROOT_DIR, 'util.c'),
os.path.join(DWM_SRC_ROOT_DIR, 'drw.c'),
os.path.join(DWM_SRC_ROOT_DIR, 'dwm.c'),
os.path.join(DWM_SRC_ROOT_DIR, 'util.c'),
],
)

Expand Down Expand Up @@ -151,10 +144,6 @@ def get_export_symbols(self, ext):
def get_ext_filename(self, ext_name):
return ext_name + '.so'

@property
def dwm_version(self):
return 'custom' if self.dwm_source else VERSION

setup(
name='pydwm',
url='https://github.com/benwah/pydwm',
Expand Down

0 comments on commit cda4671

Please sign in to comment.