Commit e4ea91b0 authored by Mat's avatar Mat
Browse files

Drop support for python 2.x

parent 525e5950
Loading
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
#
# This file is part of SharedArray.
# Copyright (C) 2014-2017 Mathieu Mirmont <mat@parad0x.org>
# Copyright (C) 2014-2023 Mathieu Mirmont <mat@parad0x.org>
#
# SharedArray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,16 +24,7 @@ variables:
before_script:
  - apt-get update

build:python2:
  stage: build
  script:
    - apt-get install -y libc6-dev gcc make python2-dev wget
    - wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -O get-pip.py
    - python2 get-pip.py
    - python2 -m pip install setuptools numpy
    - python2 setup.py build_ext --inplace

build:python3:
build:
  stage: build
  script:
    - apt-get install -y libc6-dev gcc make python3-numpy python3-dev python3-setuptools
+1 −6
Original line number Diff line number Diff line
#!/usr/bin/env python
#
# This file is part of SharedArray.
# Copyright (C) 2014-2018 Mathieu Mirmont <mat@parad0x.org>
# Copyright (C) 2014-2023 Mathieu Mirmont <mat@parad0x.org>
#
# SharedArray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -99,12 +99,7 @@ setup(
        'Operating System :: POSIX',
        'Operating System :: Unix',
        'Programming Language :: C',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
    ],
    keywords = 'numpy array shared memory shm',

+3 −29
Original line number Diff line number Diff line
/*
 * This file is part of SharedArray.
 * Copyright (C) 2014-2017 Mathieu Mirmont <mat@parad0x.org>
 * Copyright (C) 2014-2023 Mathieu Mirmont <mat@parad0x.org>
 *
 * SharedArray is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -59,8 +59,6 @@ static PyMethodDef module_functions[] = {
	{ NULL, NULL, 0, NULL }
};

#if PY_MAJOR_VERSION >= 3

/*
 * Module definition
 */
@@ -76,19 +74,10 @@ static struct PyModuleDef module_def = {
        NULL,			/* m_free	*/
};

/* Module creation function for python 3 */
#define CREATE_MODULE(NAME, FUNCTIONS, DOCSTRING)	\
	PyModule_Create(&module_def)
#else
/* Module creation function for python 2 */
#define CREATE_MODULE(NAME, FUNCTIONS, DOCSTRING)	\
	Py_InitModule3(NAME, FUNCTIONS, DOCSTRING)
#endif

/*
 * Module initialisation
 */
static PyObject *module_init(void)
PyObject *PyInit_SharedArray(void)
{
	PyObject *m;

@@ -96,7 +85,7 @@ static PyObject *module_init(void)
	import_array1(NULL);

	/* Register the module */
	if (!(m = CREATE_MODULE(module_name, module_functions, module_docstring)))
	if (!(m = PyModule_Create(&module_def)))
		return NULL;

	/* Register constants */
@@ -117,18 +106,3 @@ static PyObject *module_init(void)

	return m;
}

/*
 * Python 2.7 compatibility blob
 */
#if PY_MAJOR_VERSION >= 3
PyMODINIT_FUNC PyInit_SharedArray(void)
{
	return module_init();
}
#else
PyMODINIT_FUNC initSharedArray(void)
{
	module_init();
}
#endif