| 1 | /* Generated by Pyrex 0.9.3 on Thu Jun 9 16:58:27 2005 */ |
| 2 | |
| 3 | #include "Python.h" |
| 4 | #include "structmember.h" |
| 5 | #ifndef PY_LONG_LONG |
| 6 | #define PY_LONG_LONG LONG_LONG |
| 7 | #endif |
| 8 | #include "checkpath.h" |
| 9 | |
| 10 | |
| 11 | typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ |
| 12 | typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/ |
| 13 | static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/ |
| 14 | static int __Pyx_EndUnpack(PyObject *, int); /*proto*/ |
| 15 | static int __Pyx_PrintItem(PyObject *); /*proto*/ |
| 16 | static int __Pyx_PrintNewline(void); /*proto*/ |
| 17 | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ |
| 18 | static void __Pyx_ReRaise(void); /*proto*/ |
| 19 | static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ |
| 20 | static PyObject *__Pyx_GetExcValue(void); /*proto*/ |
| 21 | static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/ |
| 22 | static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ |
| 23 | static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/ |
| 24 | static void __Pyx_WriteUnraisable(char *name); /*proto*/ |
| 25 | static void __Pyx_AddTraceback(char *funcname); /*proto*/ |
| 26 | static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/ |
| 27 | static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ |
| 28 | static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/ |
| 29 | static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/ |
| 30 | static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/ |
| 31 | static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ |
| 32 | static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ |
| 33 | |
| 34 | static PyObject *__pyx_m; |
| 35 | static PyObject *__pyx_b; |
| 36 | static int __pyx_lineno; |
| 37 | static char *__pyx_filename; |
| 38 | staticforward char **__pyx_f; |
| 39 | |
| 40 | /* Declarations from checkpath */ |
| 41 | |
| 42 | staticforward PyTypeObject __pyx_type_9checkpath_CheckPath; |
| 43 | |
| 44 | struct __pyx_obj_9checkpath_CheckPath { |
| 45 | PyObject_HEAD |
| 46 | struct checkpath cp; |
| 47 | }; |
| 48 | |
| 49 | static PyTypeObject *__pyx_ptype_9checkpath_CheckPath = 0; |
| 50 | static void (__pyx_f_9checkpath_cp_report(unsigned int ,int ,char (*),char (*),void (*))); /*proto*/ |
| 51 | |
| 52 | /* Implementation of checkpath */ |
| 53 | |
| 54 | static PyObject *__pyx_n_ERROR; |
| 55 | static PyObject *__pyx_n_WRWORLD; |
| 56 | static PyObject *__pyx_n_WRGRP; |
| 57 | static PyObject *__pyx_n_WROTHGRP; |
| 58 | static PyObject *__pyx_n_WROTHUSR; |
| 59 | static PyObject *__pyx_n_PROBLEMS; |
| 60 | static PyObject *__pyx_n_SYMLINK; |
| 61 | static PyObject *__pyx_n_REPORT; |
| 62 | static PyObject *__pyx_n_STICKYOK; |
| 63 | |
| 64 | static PyObject *__pyx_n_report; |
| 65 | |
| 66 | static char (__pyx_k1[]) = "<null>"; |
| 67 | |
| 68 | static void __pyx_f_9checkpath_cp_report(unsigned int __pyx_v_what,int __pyx_v_verb,char (*__pyx_v_path),char (*__pyx_v_msg),void (*__pyx_v_arg)) { |
| 69 | PyObject *__pyx_v_cp; |
| 70 | PyObject *__pyx_1 = 0; |
| 71 | int __pyx_2; |
| 72 | PyObject *__pyx_3 = 0; |
| 73 | PyObject *__pyx_4 = 0; |
| 74 | PyObject *__pyx_5 = 0; |
| 75 | PyObject *__pyx_6 = 0; |
| 76 | PyObject *__pyx_7 = 0; |
| 77 | __pyx_v_cp = Py_None; Py_INCREF(__pyx_v_cp); |
| 78 | |
| 79 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":44 */ |
| 80 | __pyx_1 = (PyObject *)__pyx_v_arg; |
| 81 | Py_INCREF(__pyx_1); |
| 82 | Py_DECREF(__pyx_v_cp); |
| 83 | __pyx_v_cp = __pyx_1; |
| 84 | __pyx_1 = 0; |
| 85 | |
| 86 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":45 */ |
| 87 | __pyx_2 = (__pyx_v_msg == 0); |
| 88 | if (__pyx_2) { |
| 89 | |
| 90 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":46 */ |
| 91 | __pyx_v_msg = __pyx_k1; |
| 92 | goto __pyx_L2; |
| 93 | } |
| 94 | __pyx_L2:; |
| 95 | |
| 96 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":47 */ |
| 97 | __pyx_1 = PyObject_GetAttr(__pyx_v_cp, __pyx_n_report); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;} |
| 98 | __pyx_3 = PyInt_FromLong(__pyx_v_what); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;} |
| 99 | __pyx_4 = PyInt_FromLong(__pyx_v_verb); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;} |
| 100 | __pyx_5 = PyString_FromString(__pyx_v_path); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;} |
| 101 | __pyx_6 = PyString_FromString(__pyx_v_msg); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;} |
| 102 | __pyx_7 = PyTuple_New(4); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;} |
| 103 | PyTuple_SET_ITEM(__pyx_7, 0, __pyx_3); |
| 104 | PyTuple_SET_ITEM(__pyx_7, 1, __pyx_4); |
| 105 | PyTuple_SET_ITEM(__pyx_7, 2, __pyx_5); |
| 106 | PyTuple_SET_ITEM(__pyx_7, 3, __pyx_6); |
| 107 | __pyx_3 = 0; |
| 108 | __pyx_4 = 0; |
| 109 | __pyx_5 = 0; |
| 110 | __pyx_6 = 0; |
| 111 | __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_7); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;} |
| 112 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 113 | Py_DECREF(__pyx_7); __pyx_7 = 0; |
| 114 | Py_DECREF(__pyx_3); __pyx_3 = 0; |
| 115 | |
| 116 | goto __pyx_L0; |
| 117 | __pyx_L1:; |
| 118 | Py_XDECREF(__pyx_1); |
| 119 | Py_XDECREF(__pyx_3); |
| 120 | Py_XDECREF(__pyx_4); |
| 121 | Py_XDECREF(__pyx_5); |
| 122 | Py_XDECREF(__pyx_6); |
| 123 | Py_XDECREF(__pyx_7); |
| 124 | __Pyx_WriteUnraisable("checkpath.cp_report"); |
| 125 | __pyx_L0:; |
| 126 | Py_DECREF(__pyx_v_cp); |
| 127 | } |
| 128 | |
| 129 | static int __pyx_f_9checkpath_9CheckPath___init__(PyObject *__pyx_v_me, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 130 | static int __pyx_f_9checkpath_9CheckPath___init__(PyObject *__pyx_v_me, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 131 | int __pyx_r; |
| 132 | static char *__pyx_argnames[] = {0}; |
| 133 | if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1; |
| 134 | Py_INCREF(__pyx_v_me); |
| 135 | |
| 136 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":52 */ |
| 137 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_uid = 0; |
| 138 | |
| 139 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":53 */ |
| 140 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_gids = 0; |
| 141 | |
| 142 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":54 */ |
| 143 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_verbose = 1; |
| 144 | |
| 145 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":55 */ |
| 146 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_what = CP_PROBLEMS; |
| 147 | |
| 148 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":56 */ |
| 149 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_report = __pyx_f_9checkpath_cp_report; |
| 150 | |
| 151 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":57 */ |
| 152 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_arg = ((void (*))__pyx_v_me); |
| 153 | |
| 154 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":58 */ |
| 155 | checkpath_setids((&((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp)); |
| 156 | |
| 157 | __pyx_r = 0; |
| 158 | goto __pyx_L0; |
| 159 | __pyx_L1:; |
| 160 | __Pyx_AddTraceback("checkpath.CheckPath.__init__"); |
| 161 | __pyx_r = -1; |
| 162 | __pyx_L0:; |
| 163 | Py_DECREF(__pyx_v_me); |
| 164 | return __pyx_r; |
| 165 | } |
| 166 | |
| 167 | static PyObject *__pyx_f_9checkpath_9CheckPath_setids(PyObject *__pyx_v_me, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 168 | static PyObject *__pyx_f_9checkpath_9CheckPath_setids(PyObject *__pyx_v_me, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 169 | PyObject *__pyx_r; |
| 170 | static char *__pyx_argnames[] = {0}; |
| 171 | if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; |
| 172 | Py_INCREF(__pyx_v_me); |
| 173 | |
| 174 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":60 */ |
| 175 | checkpath_setids((&((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp)); |
| 176 | |
| 177 | __pyx_r = Py_None; Py_INCREF(__pyx_r); |
| 178 | goto __pyx_L0; |
| 179 | __pyx_L1:; |
| 180 | __Pyx_AddTraceback("checkpath.CheckPath.setids"); |
| 181 | __pyx_r = 0; |
| 182 | __pyx_L0:; |
| 183 | Py_DECREF(__pyx_v_me); |
| 184 | return __pyx_r; |
| 185 | } |
| 186 | |
| 187 | static PyObject *__pyx_f_9checkpath_9CheckPath_3uid___get__(PyObject *__pyx_v_me); /*proto*/ |
| 188 | static PyObject *__pyx_f_9checkpath_9CheckPath_3uid___get__(PyObject *__pyx_v_me) { |
| 189 | PyObject *__pyx_r; |
| 190 | PyObject *__pyx_1 = 0; |
| 191 | Py_INCREF(__pyx_v_me); |
| 192 | |
| 193 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":63 */ |
| 194 | __pyx_1 = PyInt_FromLong(((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_uid); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;} |
| 195 | __pyx_r = __pyx_1; |
| 196 | __pyx_1 = 0; |
| 197 | goto __pyx_L0; |
| 198 | |
| 199 | __pyx_r = Py_None; Py_INCREF(__pyx_r); |
| 200 | goto __pyx_L0; |
| 201 | __pyx_L1:; |
| 202 | Py_XDECREF(__pyx_1); |
| 203 | __Pyx_AddTraceback("checkpath.CheckPath.uid.__get__"); |
| 204 | __pyx_r = 0; |
| 205 | __pyx_L0:; |
| 206 | Py_DECREF(__pyx_v_me); |
| 207 | return __pyx_r; |
| 208 | } |
| 209 | |
| 210 | static int __pyx_f_9checkpath_9CheckPath_3uid___set__(PyObject *__pyx_v_me, PyObject *__pyx_v_val); /*proto*/ |
| 211 | static int __pyx_f_9checkpath_9CheckPath_3uid___set__(PyObject *__pyx_v_me, PyObject *__pyx_v_val) { |
| 212 | int __pyx_r; |
| 213 | uid_t __pyx_1; |
| 214 | Py_INCREF(__pyx_v_me); |
| 215 | Py_INCREF(__pyx_v_val); |
| 216 | |
| 217 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":65 */ |
| 218 | __pyx_1 = PyInt_AsLong(__pyx_v_val); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;} |
| 219 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_uid = __pyx_1; |
| 220 | |
| 221 | __pyx_r = 0; |
| 222 | goto __pyx_L0; |
| 223 | __pyx_L1:; |
| 224 | __Pyx_AddTraceback("checkpath.CheckPath.uid.__set__"); |
| 225 | __pyx_r = -1; |
| 226 | __pyx_L0:; |
| 227 | Py_DECREF(__pyx_v_me); |
| 228 | Py_DECREF(__pyx_v_val); |
| 229 | return __pyx_r; |
| 230 | } |
| 231 | |
| 232 | static PyObject *__pyx_f_9checkpath_9CheckPath_4gids___get__(PyObject *__pyx_v_me); /*proto*/ |
| 233 | static PyObject *__pyx_f_9checkpath_9CheckPath_4gids___get__(PyObject *__pyx_v_me) { |
| 234 | PyObject *__pyx_v_g; |
| 235 | PyObject *__pyx_v_i; |
| 236 | PyObject *__pyx_r; |
| 237 | PyObject *__pyx_1 = 0; |
| 238 | long __pyx_2; |
| 239 | int __pyx_3; |
| 240 | int __pyx_4; |
| 241 | Py_INCREF(__pyx_v_me); |
| 242 | __pyx_v_g = Py_None; Py_INCREF(__pyx_v_g); |
| 243 | __pyx_v_i = Py_None; Py_INCREF(__pyx_v_i); |
| 244 | |
| 245 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":68 */ |
| 246 | __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;} |
| 247 | Py_DECREF(__pyx_v_g); |
| 248 | __pyx_v_g = __pyx_1; |
| 249 | __pyx_1 = 0; |
| 250 | |
| 251 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":69 */ |
| 252 | __pyx_3 = ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_gids; |
| 253 | for (__pyx_2 = 0; __pyx_2 < __pyx_3; ++__pyx_2) { |
| 254 | __pyx_1 = PyInt_FromLong(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} |
| 255 | Py_DECREF(__pyx_v_i); |
| 256 | __pyx_v_i = __pyx_1; |
| 257 | __pyx_1 = 0; |
| 258 | |
| 259 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":70 */ |
| 260 | __pyx_4 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;} |
| 261 | __pyx_1 = PyInt_FromLong((((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_gid[__pyx_4])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;} |
| 262 | if (PyObject_SetItem(__pyx_v_g, __pyx_v_i, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;} |
| 263 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 264 | __pyx_L2:; |
| 265 | } |
| 266 | __pyx_L3:; |
| 267 | |
| 268 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":71 */ |
| 269 | Py_INCREF(__pyx_v_g); |
| 270 | __pyx_r = __pyx_v_g; |
| 271 | goto __pyx_L0; |
| 272 | |
| 273 | __pyx_r = Py_None; Py_INCREF(__pyx_r); |
| 274 | goto __pyx_L0; |
| 275 | __pyx_L1:; |
| 276 | Py_XDECREF(__pyx_1); |
| 277 | __Pyx_AddTraceback("checkpath.CheckPath.gids.__get__"); |
| 278 | __pyx_r = 0; |
| 279 | __pyx_L0:; |
| 280 | Py_DECREF(__pyx_v_g); |
| 281 | Py_DECREF(__pyx_v_i); |
| 282 | Py_DECREF(__pyx_v_me); |
| 283 | return __pyx_r; |
| 284 | } |
| 285 | |
| 286 | static PyObject *__pyx_n_len; |
| 287 | static PyObject *__pyx_n_TypeError; |
| 288 | |
| 289 | static PyObject *__pyx_k2p; |
| 290 | |
| 291 | static char (__pyx_k2[]) = "too many groups"; |
| 292 | |
| 293 | static int __pyx_f_9checkpath_9CheckPath_4gids___set__(PyObject *__pyx_v_me, PyObject *__pyx_v_val); /*proto*/ |
| 294 | static int __pyx_f_9checkpath_9CheckPath_4gids___set__(PyObject *__pyx_v_me, PyObject *__pyx_v_val) { |
| 295 | PyObject *__pyx_v_i; |
| 296 | int __pyx_r; |
| 297 | PyObject *__pyx_1 = 0; |
| 298 | PyObject *__pyx_2 = 0; |
| 299 | PyObject *__pyx_3 = 0; |
| 300 | int __pyx_4; |
| 301 | long __pyx_5; |
| 302 | long __pyx_6; |
| 303 | gid_t __pyx_7; |
| 304 | Py_INCREF(__pyx_v_me); |
| 305 | Py_INCREF(__pyx_v_val); |
| 306 | __pyx_v_i = Py_None; Py_INCREF(__pyx_v_i); |
| 307 | |
| 308 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":73 */ |
| 309 | __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;} |
| 310 | __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;} |
| 311 | Py_INCREF(__pyx_v_val); |
| 312 | PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_val); |
| 313 | __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;} |
| 314 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 315 | Py_DECREF(__pyx_2); __pyx_2 = 0; |
| 316 | __pyx_1 = PyInt_FromLong((NGROUPS_MAX + 1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;} |
| 317 | if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;} |
| 318 | __pyx_4 = __pyx_4 >= 0; |
| 319 | Py_DECREF(__pyx_3); __pyx_3 = 0; |
| 320 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 321 | if (__pyx_4) { |
| 322 | |
| 323 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":74 */ |
| 324 | __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;} |
| 325 | __Pyx_Raise(__pyx_2, __pyx_k2p, 0); |
| 326 | Py_DECREF(__pyx_2); __pyx_2 = 0; |
| 327 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;} |
| 328 | goto __pyx_L2; |
| 329 | } |
| 330 | __pyx_L2:; |
| 331 | |
| 332 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":75 */ |
| 333 | __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} |
| 334 | __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} |
| 335 | Py_INCREF(__pyx_v_val); |
| 336 | PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_val); |
| 337 | __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} |
| 338 | Py_DECREF(__pyx_3); __pyx_3 = 0; |
| 339 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 340 | __pyx_6 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} |
| 341 | Py_DECREF(__pyx_2); __pyx_2 = 0; |
| 342 | for (__pyx_5 = 0; __pyx_5 < __pyx_6; ++__pyx_5) { |
| 343 | __pyx_3 = PyInt_FromLong(__pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} |
| 344 | Py_DECREF(__pyx_v_i); |
| 345 | __pyx_v_i = __pyx_3; |
| 346 | __pyx_3 = 0; |
| 347 | |
| 348 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":76 */ |
| 349 | __pyx_1 = PyObject_GetItem(__pyx_v_val, __pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;} |
| 350 | __pyx_7 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;} |
| 351 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 352 | __pyx_4 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;} |
| 353 | (((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_gid[__pyx_4]) = __pyx_7; |
| 354 | __pyx_L3:; |
| 355 | } |
| 356 | __pyx_L4:; |
| 357 | |
| 358 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":77 */ |
| 359 | __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;} |
| 360 | __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;} |
| 361 | Py_INCREF(__pyx_v_val); |
| 362 | PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_val); |
| 363 | __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;} |
| 364 | Py_DECREF(__pyx_2); __pyx_2 = 0; |
| 365 | Py_DECREF(__pyx_3); __pyx_3 = 0; |
| 366 | __pyx_4 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;} |
| 367 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 368 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_gids = __pyx_4; |
| 369 | |
| 370 | __pyx_r = 0; |
| 371 | goto __pyx_L0; |
| 372 | __pyx_L1:; |
| 373 | Py_XDECREF(__pyx_1); |
| 374 | Py_XDECREF(__pyx_2); |
| 375 | Py_XDECREF(__pyx_3); |
| 376 | __Pyx_AddTraceback("checkpath.CheckPath.gids.__set__"); |
| 377 | __pyx_r = -1; |
| 378 | __pyx_L0:; |
| 379 | Py_DECREF(__pyx_v_i); |
| 380 | Py_DECREF(__pyx_v_me); |
| 381 | Py_DECREF(__pyx_v_val); |
| 382 | return __pyx_r; |
| 383 | } |
| 384 | |
| 385 | static PyObject *__pyx_f_9checkpath_9CheckPath_7verbose___get__(PyObject *__pyx_v_me); /*proto*/ |
| 386 | static PyObject *__pyx_f_9checkpath_9CheckPath_7verbose___get__(PyObject *__pyx_v_me) { |
| 387 | PyObject *__pyx_r; |
| 388 | PyObject *__pyx_1 = 0; |
| 389 | Py_INCREF(__pyx_v_me); |
| 390 | |
| 391 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":80 */ |
| 392 | __pyx_1 = PyInt_FromLong(((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_verbose); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;} |
| 393 | __pyx_r = __pyx_1; |
| 394 | __pyx_1 = 0; |
| 395 | goto __pyx_L0; |
| 396 | |
| 397 | __pyx_r = Py_None; Py_INCREF(__pyx_r); |
| 398 | goto __pyx_L0; |
| 399 | __pyx_L1:; |
| 400 | Py_XDECREF(__pyx_1); |
| 401 | __Pyx_AddTraceback("checkpath.CheckPath.verbose.__get__"); |
| 402 | __pyx_r = 0; |
| 403 | __pyx_L0:; |
| 404 | Py_DECREF(__pyx_v_me); |
| 405 | return __pyx_r; |
| 406 | } |
| 407 | |
| 408 | static int __pyx_f_9checkpath_9CheckPath_7verbose___set__(PyObject *__pyx_v_me, PyObject *__pyx_v_val); /*proto*/ |
| 409 | static int __pyx_f_9checkpath_9CheckPath_7verbose___set__(PyObject *__pyx_v_me, PyObject *__pyx_v_val) { |
| 410 | int __pyx_r; |
| 411 | int __pyx_1; |
| 412 | Py_INCREF(__pyx_v_me); |
| 413 | Py_INCREF(__pyx_v_val); |
| 414 | |
| 415 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":82 */ |
| 416 | __pyx_1 = PyInt_AsLong(__pyx_v_val); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;} |
| 417 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_verbose = __pyx_1; |
| 418 | |
| 419 | __pyx_r = 0; |
| 420 | goto __pyx_L0; |
| 421 | __pyx_L1:; |
| 422 | __Pyx_AddTraceback("checkpath.CheckPath.verbose.__set__"); |
| 423 | __pyx_r = -1; |
| 424 | __pyx_L0:; |
| 425 | Py_DECREF(__pyx_v_me); |
| 426 | Py_DECREF(__pyx_v_val); |
| 427 | return __pyx_r; |
| 428 | } |
| 429 | |
| 430 | static PyObject *__pyx_f_9checkpath_9CheckPath_4what___get__(PyObject *__pyx_v_me); /*proto*/ |
| 431 | static PyObject *__pyx_f_9checkpath_9CheckPath_4what___get__(PyObject *__pyx_v_me) { |
| 432 | PyObject *__pyx_r; |
| 433 | PyObject *__pyx_1 = 0; |
| 434 | Py_INCREF(__pyx_v_me); |
| 435 | |
| 436 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":85 */ |
| 437 | __pyx_1 = PyInt_FromLong(((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_what); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;} |
| 438 | __pyx_r = __pyx_1; |
| 439 | __pyx_1 = 0; |
| 440 | goto __pyx_L0; |
| 441 | |
| 442 | __pyx_r = Py_None; Py_INCREF(__pyx_r); |
| 443 | goto __pyx_L0; |
| 444 | __pyx_L1:; |
| 445 | Py_XDECREF(__pyx_1); |
| 446 | __Pyx_AddTraceback("checkpath.CheckPath.what.__get__"); |
| 447 | __pyx_r = 0; |
| 448 | __pyx_L0:; |
| 449 | Py_DECREF(__pyx_v_me); |
| 450 | return __pyx_r; |
| 451 | } |
| 452 | |
| 453 | static int __pyx_f_9checkpath_9CheckPath_4what___set__(PyObject *__pyx_v_me, PyObject *__pyx_v_val); /*proto*/ |
| 454 | static int __pyx_f_9checkpath_9CheckPath_4what___set__(PyObject *__pyx_v_me, PyObject *__pyx_v_val) { |
| 455 | int __pyx_r; |
| 456 | unsigned int __pyx_1; |
| 457 | Py_INCREF(__pyx_v_me); |
| 458 | Py_INCREF(__pyx_v_val); |
| 459 | |
| 460 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":87 */ |
| 461 | __pyx_1 = PyInt_AsLong(__pyx_v_val); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;} |
| 462 | ((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp.cp_what = __pyx_1; |
| 463 | |
| 464 | __pyx_r = 0; |
| 465 | goto __pyx_L0; |
| 466 | __pyx_L1:; |
| 467 | __Pyx_AddTraceback("checkpath.CheckPath.what.__set__"); |
| 468 | __pyx_r = -1; |
| 469 | __pyx_L0:; |
| 470 | Py_DECREF(__pyx_v_me); |
| 471 | Py_DECREF(__pyx_v_val); |
| 472 | return __pyx_r; |
| 473 | } |
| 474 | |
| 475 | static PyObject *__pyx_f_9checkpath_9CheckPath_check(PyObject *__pyx_v_me, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 476 | static PyObject *__pyx_f_9checkpath_9CheckPath_check(PyObject *__pyx_v_me, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 477 | PyObject *__pyx_v_path = 0; |
| 478 | PyObject *__pyx_r; |
| 479 | char (*__pyx_1); |
| 480 | int __pyx_2; |
| 481 | PyObject *__pyx_3 = 0; |
| 482 | static char *__pyx_argnames[] = {"path",0}; |
| 483 | if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_path)) return 0; |
| 484 | Py_INCREF(__pyx_v_me); |
| 485 | Py_INCREF(__pyx_v_path); |
| 486 | |
| 487 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":89 */ |
| 488 | __pyx_1 = PyString_AsString(__pyx_v_path); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;} |
| 489 | __pyx_2 = checkpath(__pyx_1,(&((struct __pyx_obj_9checkpath_CheckPath *)__pyx_v_me)->cp)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;} |
| 490 | __pyx_3 = PyInt_FromLong(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;} |
| 491 | __pyx_r = __pyx_3; |
| 492 | __pyx_3 = 0; |
| 493 | goto __pyx_L0; |
| 494 | |
| 495 | __pyx_r = Py_None; Py_INCREF(__pyx_r); |
| 496 | goto __pyx_L0; |
| 497 | __pyx_L1:; |
| 498 | Py_XDECREF(__pyx_3); |
| 499 | __Pyx_AddTraceback("checkpath.CheckPath.check"); |
| 500 | __pyx_r = 0; |
| 501 | __pyx_L0:; |
| 502 | Py_DECREF(__pyx_v_me); |
| 503 | Py_DECREF(__pyx_v_path); |
| 504 | return __pyx_r; |
| 505 | } |
| 506 | |
| 507 | static PyObject *__pyx_f_9checkpath_9CheckPath_report(PyObject *__pyx_v_me, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 508 | static PyObject *__pyx_f_9checkpath_9CheckPath_report(PyObject *__pyx_v_me, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 509 | PyObject *__pyx_v_what = 0; |
| 510 | PyObject *__pyx_v_verb = 0; |
| 511 | PyObject *__pyx_v_path = 0; |
| 512 | PyObject *__pyx_v_msg = 0; |
| 513 | PyObject *__pyx_r; |
| 514 | static char *__pyx_argnames[] = {"what","verb","path","msg",0}; |
| 515 | if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO", __pyx_argnames, &__pyx_v_what, &__pyx_v_verb, &__pyx_v_path, &__pyx_v_msg)) return 0; |
| 516 | Py_INCREF(__pyx_v_me); |
| 517 | Py_INCREF(__pyx_v_what); |
| 518 | Py_INCREF(__pyx_v_verb); |
| 519 | Py_INCREF(__pyx_v_path); |
| 520 | Py_INCREF(__pyx_v_msg); |
| 521 | |
| 522 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":91 */ |
| 523 | |
| 524 | __pyx_r = Py_None; Py_INCREF(__pyx_r); |
| 525 | goto __pyx_L0; |
| 526 | __pyx_L1:; |
| 527 | __Pyx_AddTraceback("checkpath.CheckPath.report"); |
| 528 | __pyx_r = 0; |
| 529 | __pyx_L0:; |
| 530 | Py_DECREF(__pyx_v_me); |
| 531 | Py_DECREF(__pyx_v_what); |
| 532 | Py_DECREF(__pyx_v_verb); |
| 533 | Py_DECREF(__pyx_v_path); |
| 534 | Py_DECREF(__pyx_v_msg); |
| 535 | return __pyx_r; |
| 536 | } |
| 537 | |
| 538 | static __Pyx_InternTabEntry __pyx_intern_tab[] = { |
| 539 | {&__pyx_n_ERROR, "ERROR"}, |
| 540 | {&__pyx_n_PROBLEMS, "PROBLEMS"}, |
| 541 | {&__pyx_n_REPORT, "REPORT"}, |
| 542 | {&__pyx_n_STICKYOK, "STICKYOK"}, |
| 543 | {&__pyx_n_SYMLINK, "SYMLINK"}, |
| 544 | {&__pyx_n_TypeError, "TypeError"}, |
| 545 | {&__pyx_n_WRGRP, "WRGRP"}, |
| 546 | {&__pyx_n_WROTHGRP, "WROTHGRP"}, |
| 547 | {&__pyx_n_WROTHUSR, "WROTHUSR"}, |
| 548 | {&__pyx_n_WRWORLD, "WRWORLD"}, |
| 549 | {&__pyx_n_len, "len"}, |
| 550 | {&__pyx_n_report, "report"}, |
| 551 | {0, 0} |
| 552 | }; |
| 553 | |
| 554 | static __Pyx_StringTabEntry __pyx_string_tab[] = { |
| 555 | {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)}, |
| 556 | {0, 0, 0} |
| 557 | }; |
| 558 | |
| 559 | static PyObject *__pyx_tp_new_9checkpath_CheckPath(PyTypeObject *t, PyObject *a, PyObject *k) { |
| 560 | PyObject *o = (*t->tp_alloc)(t, 0); |
| 561 | struct __pyx_obj_9checkpath_CheckPath *p = (struct __pyx_obj_9checkpath_CheckPath *)o; |
| 562 | return o; |
| 563 | } |
| 564 | |
| 565 | static void __pyx_tp_dealloc_9checkpath_CheckPath(PyObject *o) { |
| 566 | struct __pyx_obj_9checkpath_CheckPath *p = (struct __pyx_obj_9checkpath_CheckPath *)o; |
| 567 | (*o->ob_type->tp_free)(o); |
| 568 | } |
| 569 | |
| 570 | static int __pyx_tp_traverse_9checkpath_CheckPath(PyObject *o, visitproc v, void *a) { |
| 571 | int e; |
| 572 | struct __pyx_obj_9checkpath_CheckPath *p = (struct __pyx_obj_9checkpath_CheckPath *)o; |
| 573 | return 0; |
| 574 | } |
| 575 | |
| 576 | static int __pyx_tp_clear_9checkpath_CheckPath(PyObject *o) { |
| 577 | struct __pyx_obj_9checkpath_CheckPath *p = (struct __pyx_obj_9checkpath_CheckPath *)o; |
| 578 | return 0; |
| 579 | } |
| 580 | |
| 581 | static PyObject *__pyx_getprop_9checkpath_9CheckPath_uid(PyObject *o, void *x) { |
| 582 | return __pyx_f_9checkpath_9CheckPath_3uid___get__(o); |
| 583 | } |
| 584 | |
| 585 | static int __pyx_setprop_9checkpath_9CheckPath_uid(PyObject *o, PyObject *v, void *x) { |
| 586 | if (v) { |
| 587 | return __pyx_f_9checkpath_9CheckPath_3uid___set__(o, v); |
| 588 | } |
| 589 | else { |
| 590 | PyErr_SetString(PyExc_NotImplementedError, "__del__"); |
| 591 | return -1; |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | static PyObject *__pyx_getprop_9checkpath_9CheckPath_gids(PyObject *o, void *x) { |
| 596 | return __pyx_f_9checkpath_9CheckPath_4gids___get__(o); |
| 597 | } |
| 598 | |
| 599 | static int __pyx_setprop_9checkpath_9CheckPath_gids(PyObject *o, PyObject *v, void *x) { |
| 600 | if (v) { |
| 601 | return __pyx_f_9checkpath_9CheckPath_4gids___set__(o, v); |
| 602 | } |
| 603 | else { |
| 604 | PyErr_SetString(PyExc_NotImplementedError, "__del__"); |
| 605 | return -1; |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | static PyObject *__pyx_getprop_9checkpath_9CheckPath_verbose(PyObject *o, void *x) { |
| 610 | return __pyx_f_9checkpath_9CheckPath_7verbose___get__(o); |
| 611 | } |
| 612 | |
| 613 | static int __pyx_setprop_9checkpath_9CheckPath_verbose(PyObject *o, PyObject *v, void *x) { |
| 614 | if (v) { |
| 615 | return __pyx_f_9checkpath_9CheckPath_7verbose___set__(o, v); |
| 616 | } |
| 617 | else { |
| 618 | PyErr_SetString(PyExc_NotImplementedError, "__del__"); |
| 619 | return -1; |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | static PyObject *__pyx_getprop_9checkpath_9CheckPath_what(PyObject *o, void *x) { |
| 624 | return __pyx_f_9checkpath_9CheckPath_4what___get__(o); |
| 625 | } |
| 626 | |
| 627 | static int __pyx_setprop_9checkpath_9CheckPath_what(PyObject *o, PyObject *v, void *x) { |
| 628 | if (v) { |
| 629 | return __pyx_f_9checkpath_9CheckPath_4what___set__(o, v); |
| 630 | } |
| 631 | else { |
| 632 | PyErr_SetString(PyExc_NotImplementedError, "__del__"); |
| 633 | return -1; |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | static struct PyMethodDef __pyx_methods_9checkpath_CheckPath[] = { |
| 638 | {"setids", (PyCFunction)__pyx_f_9checkpath_9CheckPath_setids, METH_VARARGS|METH_KEYWORDS, 0}, |
| 639 | {"check", (PyCFunction)__pyx_f_9checkpath_9CheckPath_check, METH_VARARGS|METH_KEYWORDS, 0}, |
| 640 | {"report", (PyCFunction)__pyx_f_9checkpath_9CheckPath_report, METH_VARARGS|METH_KEYWORDS, 0}, |
| 641 | {0, 0, 0, 0} |
| 642 | }; |
| 643 | |
| 644 | static struct PyGetSetDef __pyx_getsets_9checkpath_CheckPath[] = { |
| 645 | {"uid", __pyx_getprop_9checkpath_9CheckPath_uid, __pyx_setprop_9checkpath_9CheckPath_uid, 0, 0}, |
| 646 | {"gids", __pyx_getprop_9checkpath_9CheckPath_gids, __pyx_setprop_9checkpath_9CheckPath_gids, 0, 0}, |
| 647 | {"verbose", __pyx_getprop_9checkpath_9CheckPath_verbose, __pyx_setprop_9checkpath_9CheckPath_verbose, 0, 0}, |
| 648 | {"what", __pyx_getprop_9checkpath_9CheckPath_what, __pyx_setprop_9checkpath_9CheckPath_what, 0, 0}, |
| 649 | {0, 0, 0, 0, 0} |
| 650 | }; |
| 651 | |
| 652 | static PyNumberMethods __pyx_tp_as_number_CheckPath = { |
| 653 | 0, /*nb_add*/ |
| 654 | 0, /*nb_subtract*/ |
| 655 | 0, /*nb_multiply*/ |
| 656 | 0, /*nb_divide*/ |
| 657 | 0, /*nb_remainder*/ |
| 658 | 0, /*nb_divmod*/ |
| 659 | 0, /*nb_power*/ |
| 660 | 0, /*nb_negative*/ |
| 661 | 0, /*nb_positive*/ |
| 662 | 0, /*nb_absolute*/ |
| 663 | 0, /*nb_nonzero*/ |
| 664 | 0, /*nb_invert*/ |
| 665 | 0, /*nb_lshift*/ |
| 666 | 0, /*nb_rshift*/ |
| 667 | 0, /*nb_and*/ |
| 668 | 0, /*nb_xor*/ |
| 669 | 0, /*nb_or*/ |
| 670 | 0, /*nb_coerce*/ |
| 671 | 0, /*nb_int*/ |
| 672 | 0, /*nb_long*/ |
| 673 | 0, /*nb_float*/ |
| 674 | 0, /*nb_oct*/ |
| 675 | 0, /*nb_hex*/ |
| 676 | 0, /*nb_inplace_add*/ |
| 677 | 0, /*nb_inplace_subtract*/ |
| 678 | 0, /*nb_inplace_multiply*/ |
| 679 | 0, /*nb_inplace_divide*/ |
| 680 | 0, /*nb_inplace_remainder*/ |
| 681 | 0, /*nb_inplace_power*/ |
| 682 | 0, /*nb_inplace_lshift*/ |
| 683 | 0, /*nb_inplace_rshift*/ |
| 684 | 0, /*nb_inplace_and*/ |
| 685 | 0, /*nb_inplace_xor*/ |
| 686 | 0, /*nb_inplace_or*/ |
| 687 | 0, /*nb_floor_divide*/ |
| 688 | 0, /*nb_true_divide*/ |
| 689 | 0, /*nb_inplace_floor_divide*/ |
| 690 | 0, /*nb_inplace_true_divide*/ |
| 691 | }; |
| 692 | |
| 693 | static PySequenceMethods __pyx_tp_as_sequence_CheckPath = { |
| 694 | 0, /*sq_length*/ |
| 695 | 0, /*sq_concat*/ |
| 696 | 0, /*sq_repeat*/ |
| 697 | 0, /*sq_item*/ |
| 698 | 0, /*sq_slice*/ |
| 699 | 0, /*sq_ass_item*/ |
| 700 | 0, /*sq_ass_slice*/ |
| 701 | 0, /*sq_contains*/ |
| 702 | 0, /*sq_inplace_concat*/ |
| 703 | 0, /*sq_inplace_repeat*/ |
| 704 | }; |
| 705 | |
| 706 | static PyMappingMethods __pyx_tp_as_mapping_CheckPath = { |
| 707 | 0, /*mp_length*/ |
| 708 | 0, /*mp_subscript*/ |
| 709 | 0, /*mp_ass_subscript*/ |
| 710 | }; |
| 711 | |
| 712 | static PyBufferProcs __pyx_tp_as_buffer_CheckPath = { |
| 713 | 0, /*bf_getreadbuffer*/ |
| 714 | 0, /*bf_getwritebuffer*/ |
| 715 | 0, /*bf_getsegcount*/ |
| 716 | 0, /*bf_getcharbuffer*/ |
| 717 | }; |
| 718 | |
| 719 | statichere PyTypeObject __pyx_type_9checkpath_CheckPath = { |
| 720 | PyObject_HEAD_INIT(0) |
| 721 | 0, /*ob_size*/ |
| 722 | "checkpath.CheckPath", /*tp_name*/ |
| 723 | sizeof(struct __pyx_obj_9checkpath_CheckPath), /*tp_basicsize*/ |
| 724 | 0, /*tp_itemsize*/ |
| 725 | __pyx_tp_dealloc_9checkpath_CheckPath, /*tp_dealloc*/ |
| 726 | 0, /*tp_print*/ |
| 727 | 0, /*tp_getattr*/ |
| 728 | 0, /*tp_setattr*/ |
| 729 | 0, /*tp_compare*/ |
| 730 | 0, /*tp_repr*/ |
| 731 | &__pyx_tp_as_number_CheckPath, /*tp_as_number*/ |
| 732 | &__pyx_tp_as_sequence_CheckPath, /*tp_as_sequence*/ |
| 733 | &__pyx_tp_as_mapping_CheckPath, /*tp_as_mapping*/ |
| 734 | 0, /*tp_hash*/ |
| 735 | 0, /*tp_call*/ |
| 736 | 0, /*tp_str*/ |
| 737 | 0, /*tp_getattro*/ |
| 738 | 0, /*tp_setattro*/ |
| 739 | &__pyx_tp_as_buffer_CheckPath, /*tp_as_buffer*/ |
| 740 | Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/ |
| 741 | 0, /*tp_doc*/ |
| 742 | __pyx_tp_traverse_9checkpath_CheckPath, /*tp_traverse*/ |
| 743 | __pyx_tp_clear_9checkpath_CheckPath, /*tp_clear*/ |
| 744 | 0, /*tp_richcompare*/ |
| 745 | 0, /*tp_weaklistoffset*/ |
| 746 | 0, /*tp_iter*/ |
| 747 | 0, /*tp_iternext*/ |
| 748 | __pyx_methods_9checkpath_CheckPath, /*tp_methods*/ |
| 749 | 0, /*tp_members*/ |
| 750 | __pyx_getsets_9checkpath_CheckPath, /*tp_getset*/ |
| 751 | 0, /*tp_base*/ |
| 752 | 0, /*tp_dict*/ |
| 753 | 0, /*tp_descr_get*/ |
| 754 | 0, /*tp_descr_set*/ |
| 755 | 0, /*tp_dictoffset*/ |
| 756 | __pyx_f_9checkpath_9CheckPath___init__, /*tp_init*/ |
| 757 | 0, /*tp_alloc*/ |
| 758 | __pyx_tp_new_9checkpath_CheckPath, /*tp_new*/ |
| 759 | 0, /*tp_free*/ |
| 760 | 0, /*tp_is_gc*/ |
| 761 | 0, /*tp_bases*/ |
| 762 | 0, /*tp_mro*/ |
| 763 | 0, /*tp_cache*/ |
| 764 | 0, /*tp_subclasses*/ |
| 765 | 0, /*tp_weaklist*/ |
| 766 | }; |
| 767 | |
| 768 | static struct PyMethodDef __pyx_methods[] = { |
| 769 | {0, 0, 0, 0} |
| 770 | }; |
| 771 | |
| 772 | DL_EXPORT(void) initcheckpath(void); /*proto*/ |
| 773 | DL_EXPORT(void) initcheckpath(void) { |
| 774 | PyObject *__pyx_1 = 0; |
| 775 | __pyx_m = Py_InitModule4("checkpath", __pyx_methods, 0, 0, PYTHON_API_VERSION); |
| 776 | if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}; |
| 777 | __pyx_b = PyImport_AddModule("__builtin__"); |
| 778 | if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}; |
| 779 | if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}; |
| 780 | if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}; |
| 781 | if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}; |
| 782 | if (PyType_Ready(&__pyx_type_9checkpath_CheckPath) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;} |
| 783 | if (PyObject_SetAttrString(__pyx_m, "CheckPath", (PyObject *)&__pyx_type_9checkpath_CheckPath) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;} |
| 784 | __pyx_ptype_9checkpath_CheckPath = &__pyx_type_9checkpath_CheckPath; |
| 785 | |
| 786 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":31 */ |
| 787 | __pyx_1 = PyInt_FromLong(CP_ERROR); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;} |
| 788 | if (PyObject_SetAttr(__pyx_m, __pyx_n_ERROR, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;} |
| 789 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 790 | |
| 791 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":32 */ |
| 792 | __pyx_1 = PyInt_FromLong(CP_WRWORLD); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;} |
| 793 | if (PyObject_SetAttr(__pyx_m, __pyx_n_WRWORLD, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;} |
| 794 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 795 | |
| 796 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":33 */ |
| 797 | __pyx_1 = PyInt_FromLong(CP_WRGRP); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;} |
| 798 | if (PyObject_SetAttr(__pyx_m, __pyx_n_WRGRP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;} |
| 799 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 800 | |
| 801 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":34 */ |
| 802 | __pyx_1 = PyInt_FromLong(CP_WROTHGRP); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;} |
| 803 | if (PyObject_SetAttr(__pyx_m, __pyx_n_WROTHGRP, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;} |
| 804 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 805 | |
| 806 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":35 */ |
| 807 | __pyx_1 = PyInt_FromLong(CP_WROTHUSR); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;} |
| 808 | if (PyObject_SetAttr(__pyx_m, __pyx_n_WROTHUSR, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;} |
| 809 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 810 | |
| 811 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":36 */ |
| 812 | __pyx_1 = PyInt_FromLong(CP_PROBLEMS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; goto __pyx_L1;} |
| 813 | if (PyObject_SetAttr(__pyx_m, __pyx_n_PROBLEMS, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; goto __pyx_L1;} |
| 814 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 815 | |
| 816 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":37 */ |
| 817 | __pyx_1 = PyInt_FromLong(CP_SYMLINK); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;} |
| 818 | if (PyObject_SetAttr(__pyx_m, __pyx_n_SYMLINK, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;} |
| 819 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 820 | |
| 821 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":38 */ |
| 822 | __pyx_1 = PyInt_FromLong(CP_REPORT); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;} |
| 823 | if (PyObject_SetAttr(__pyx_m, __pyx_n_REPORT, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;} |
| 824 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 825 | |
| 826 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":39 */ |
| 827 | __pyx_1 = PyInt_FromLong(CP_STICKYOK); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;} |
| 828 | if (PyObject_SetAttr(__pyx_m, __pyx_n_STICKYOK, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;} |
| 829 | Py_DECREF(__pyx_1); __pyx_1 = 0; |
| 830 | |
| 831 | /* "/home/mdw/src/chkpath-python/checkpath.pyx":90 */ |
| 832 | return; |
| 833 | __pyx_L1:; |
| 834 | Py_XDECREF(__pyx_1); |
| 835 | __Pyx_AddTraceback("checkpath"); |
| 836 | } |
| 837 | |
| 838 | static char *__pyx_filenames[] = { |
| 839 | "checkpath.pyx", |
| 840 | }; |
| 841 | statichere char **__pyx_f = __pyx_filenames; |
| 842 | |
| 843 | /* Runtime support code */ |
| 844 | |
| 845 | static void __Pyx_WriteUnraisable(char *name) { |
| 846 | PyObject *old_exc, *old_val, *old_tb; |
| 847 | PyObject *ctx; |
| 848 | PyErr_Fetch(&old_exc, &old_val, &old_tb); |
| 849 | ctx = PyString_FromString(name); |
| 850 | PyErr_Restore(old_exc, old_val, old_tb); |
| 851 | if (!ctx) |
| 852 | ctx = Py_None; |
| 853 | PyErr_WriteUnraisable(ctx); |
| 854 | } |
| 855 | |
| 856 | static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { |
| 857 | PyObject *result; |
| 858 | result = PyObject_GetAttr(dict, name); |
| 859 | if (!result) |
| 860 | PyErr_SetObject(PyExc_NameError, name); |
| 861 | return result; |
| 862 | } |
| 863 | |
| 864 | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { |
| 865 | Py_XINCREF(type); |
| 866 | Py_XINCREF(value); |
| 867 | Py_XINCREF(tb); |
| 868 | /* First, check the traceback argument, replacing None with NULL. */ |
| 869 | if (tb == Py_None) { |
| 870 | Py_DECREF(tb); |
| 871 | tb = 0; |
| 872 | } |
| 873 | else if (tb != NULL && !PyTraceBack_Check(tb)) { |
| 874 | PyErr_SetString(PyExc_TypeError, |
| 875 | "raise: arg 3 must be a traceback or None"); |
| 876 | goto raise_error; |
| 877 | } |
| 878 | /* Next, replace a missing value with None */ |
| 879 | if (value == NULL) { |
| 880 | value = Py_None; |
| 881 | Py_INCREF(value); |
| 882 | } |
| 883 | /* Next, repeatedly, replace a tuple exception with its first item */ |
| 884 | while (PyTuple_Check(type) && PyTuple_Size(type) > 0) { |
| 885 | PyObject *tmp = type; |
| 886 | type = PyTuple_GET_ITEM(type, 0); |
| 887 | Py_INCREF(type); |
| 888 | Py_DECREF(tmp); |
| 889 | } |
| 890 | if (PyString_Check(type)) |
| 891 | ; |
| 892 | else if (PyClass_Check(type)) |
| 893 | ; /*PyErr_NormalizeException(&type, &value, &tb);*/ |
| 894 | else if (PyInstance_Check(type)) { |
| 895 | /* Raising an instance. The value should be a dummy. */ |
| 896 | if (value != Py_None) { |
| 897 | PyErr_SetString(PyExc_TypeError, |
| 898 | "instance exception may not have a separate value"); |
| 899 | goto raise_error; |
| 900 | } |
| 901 | else { |
| 902 | /* Normalize to raise <class>, <instance> */ |
| 903 | Py_DECREF(value); |
| 904 | value = type; |
| 905 | type = (PyObject*) ((PyInstanceObject*)type)->in_class; |
| 906 | Py_INCREF(type); |
| 907 | } |
| 908 | } |
| 909 | else { |
| 910 | /* Not something you can raise. You get an exception |
| 911 | anyway, just not what you specified :-) */ |
| 912 | PyErr_Format(PyExc_TypeError, |
| 913 | "exceptions must be strings, classes, or " |
| 914 | "instances, not %s", type->ob_type->tp_name); |
| 915 | goto raise_error; |
| 916 | } |
| 917 | PyErr_Restore(type, value, tb); |
| 918 | return; |
| 919 | raise_error: |
| 920 | Py_XDECREF(value); |
| 921 | Py_XDECREF(type); |
| 922 | Py_XDECREF(tb); |
| 923 | return; |
| 924 | } |
| 925 | |
| 926 | static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) { |
| 927 | while (t->p) { |
| 928 | *t->p = PyString_InternFromString(t->s); |
| 929 | if (!*t->p) |
| 930 | return -1; |
| 931 | ++t; |
| 932 | } |
| 933 | return 0; |
| 934 | } |
| 935 | |
| 936 | static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { |
| 937 | while (t->p) { |
| 938 | *t->p = PyString_FromStringAndSize(t->s, t->n - 1); |
| 939 | if (!*t->p) |
| 940 | return -1; |
| 941 | ++t; |
| 942 | } |
| 943 | return 0; |
| 944 | } |
| 945 | |
| 946 | #include "compile.h" |
| 947 | #include "frameobject.h" |
| 948 | #include "traceback.h" |
| 949 | |
| 950 | static void __Pyx_AddTraceback(char *funcname) { |
| 951 | PyObject *py_srcfile = 0; |
| 952 | PyObject *py_funcname = 0; |
| 953 | PyObject *py_globals = 0; |
| 954 | PyObject *empty_tuple = 0; |
| 955 | PyObject *empty_string = 0; |
| 956 | PyCodeObject *py_code = 0; |
| 957 | PyFrameObject *py_frame = 0; |
| 958 | |
| 959 | py_srcfile = PyString_FromString(__pyx_filename); |
| 960 | if (!py_srcfile) goto bad; |
| 961 | py_funcname = PyString_FromString(funcname); |
| 962 | if (!py_funcname) goto bad; |
| 963 | py_globals = PyModule_GetDict(__pyx_m); |
| 964 | if (!py_globals) goto bad; |
| 965 | empty_tuple = PyTuple_New(0); |
| 966 | if (!empty_tuple) goto bad; |
| 967 | empty_string = PyString_FromString(""); |
| 968 | if (!empty_string) goto bad; |
| 969 | py_code = PyCode_New( |
| 970 | 0, /*int argcount,*/ |
| 971 | 0, /*int nlocals,*/ |
| 972 | 0, /*int stacksize,*/ |
| 973 | 0, /*int flags,*/ |
| 974 | empty_string, /*PyObject *code,*/ |
| 975 | empty_tuple, /*PyObject *consts,*/ |
| 976 | empty_tuple, /*PyObject *names,*/ |
| 977 | empty_tuple, /*PyObject *varnames,*/ |
| 978 | empty_tuple, /*PyObject *freevars,*/ |
| 979 | empty_tuple, /*PyObject *cellvars,*/ |
| 980 | py_srcfile, /*PyObject *filename,*/ |
| 981 | py_funcname, /*PyObject *name,*/ |
| 982 | __pyx_lineno, /*int firstlineno,*/ |
| 983 | empty_string /*PyObject *lnotab*/ |
| 984 | ); |
| 985 | if (!py_code) goto bad; |
| 986 | py_frame = PyFrame_New( |
| 987 | PyThreadState_Get(), /*PyThreadState *tstate,*/ |
| 988 | py_code, /*PyCodeObject *code,*/ |
| 989 | py_globals, /*PyObject *globals,*/ |
| 990 | 0 /*PyObject *locals*/ |
| 991 | ); |
| 992 | if (!py_frame) goto bad; |
| 993 | py_frame->f_lineno = __pyx_lineno; |
| 994 | PyTraceBack_Here(py_frame); |
| 995 | bad: |
| 996 | Py_XDECREF(py_srcfile); |
| 997 | Py_XDECREF(py_funcname); |
| 998 | Py_XDECREF(empty_tuple); |
| 999 | Py_XDECREF(empty_string); |
| 1000 | Py_XDECREF(py_code); |
| 1001 | Py_XDECREF(py_frame); |
| 1002 | } |