pacparser 1.5.3__tar.gz → 1.5.3.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pacparser
3
- Version: 1.5.3
3
+ Version: 1.5.3.dev2
4
4
  Summary: Pacparser package
5
5
  Home-page: https://github.com/manugarg/pacparser
6
6
  Author: Manu Garg
7
7
  Author-email: manugarg@gmail.com
8
8
  License: LGPL
9
+ Dynamic: author
10
+ Dynamic: author-email
11
+ Dynamic: description
12
+ Dynamic: home-page
13
+ Dynamic: license
14
+ Dynamic: summary
9
15
 
10
16
  python library to parse proxy auto-config (PAC) files.
@@ -99,7 +99,8 @@ read_file_into_str(const char *filename)
99
99
  if (file_size == -1) goto error2;
100
100
  if (fseek(fptr, 0L, SEEK_SET) != 0) goto error2;
101
101
 
102
- char *str = (char*) malloc(file_size+1);
102
+ // calloc zero-fills the buffer, so the string is already NUL-terminated.
103
+ char *str = (char*) calloc(file_size+1, 1);
103
104
  if (str == NULL) goto error2;
104
105
 
105
106
  // Read the file into the string
@@ -109,12 +110,6 @@ read_file_into_str(const char *filename)
109
110
  goto error2;
110
111
  }
111
112
 
112
- // This check should not be needed but adding this satisfies
113
- // sonarlint static analysis, otherwise it complains about tainted
114
- // index.
115
- if (bytes_read < file_size+1) {
116
- str[bytes_read] = '\0';
117
- }
118
113
  fclose(fptr);
119
114
  return str;
120
115
  error2:
@@ -1,10 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pacparser
3
- Version: 1.5.3
3
+ Version: 1.5.3.dev2
4
4
  Summary: Pacparser package
5
5
  Home-page: https://github.com/manugarg/pacparser
6
6
  Author: Manu Garg
7
7
  Author-email: manugarg@gmail.com
8
8
  License: LGPL
9
+ Dynamic: author
10
+ Dynamic: author-email
11
+ Dynamic: description
12
+ Dynamic: home-page
13
+ Dynamic: license
14
+ Dynamic: summary
9
15
 
10
16
  python library to parse proxy auto-config (PAC) files.
@@ -246,24 +246,24 @@ def build_c_objects(cc):
246
246
  def main(patched_func):
247
247
  python_home = os.path.dirname(sys.executable)
248
248
 
249
- obj_search_path = {
250
- "pacparser.o": ["..", "."],
251
- "libquickjs.a": ["../quickjs", "quickjs", "."],
252
- }
253
- found_objects = {}
254
- for obj, paths in obj_search_path.items():
255
- for path in paths:
256
- if os.path.exists(os.path.join(path, obj)):
257
- found_objects[obj] = os.path.join(path, obj)
258
- break
259
-
260
- # When building from the sdist, the C sources are copied to the setup
261
- # directory but the prebuilt objects are not, so compile them. The
262
- # copied pacparser.c is the marker for the sdist layout; in the source
263
- # tree the sources live in the parent directory and are built by the
264
- # Makefile. Only do this for commands that build the extension, so
265
- # that other commands (sdist, egg_info, clean, ...) do not require a
266
- # C toolchain.
249
+ # When the C sources are next to setup.py (an unpacked sdist, or the
250
+ # cibuildwheel build, which copies them in), the objects must be built
251
+ # from them inside this tree: never link objects or include headers from
252
+ # the parent directory, which is outside the package and may be writable
253
+ # by other users (pip unpacks local sdists directly under $TMPDIR). In
254
+ # the source tree, the Makefile builds the objects in the parent
255
+ # directory (src/).
256
+ local_sources = os.path.exists("pacparser.c")
257
+ if local_sources:
258
+ include_dirs = ["."]
259
+ extra_objects = ["pacparser.o", os.path.join("quickjs", "libquickjs.a")]
260
+ else:
261
+ include_dirs = [".."]
262
+ extra_objects = ["../pacparser.o", "../quickjs/libquickjs.a"]
263
+
264
+ # Only compile the sdist's objects for commands that build the
265
+ # extension, so that other commands (sdist, egg_info, clean, ...) do
266
+ # not require a C toolchain.
267
267
  build_commands = ("build", "build_ext", "bdist", "bdist_wheel", "install")
268
268
  building = sys.platform != "win32" and any(
269
269
  cmd in build_commands for cmd in sys.argv[1:])
@@ -272,18 +272,8 @@ def main(patched_func):
272
272
  # also what makes setuptools use a working compiler for the
273
273
  # extension itself.
274
274
  cc = find_build_tool("CC", "cc")
275
- if (
276
- len(found_objects) < len(obj_search_path)
277
- and building
278
- and os.path.exists("pacparser.c")
279
- ):
280
- build_c_objects(cc)
281
- found_objects["pacparser.o"] = found_objects.get(
282
- "pacparser.o", "pacparser.o")
283
- found_objects["libquickjs.a"] = found_objects.get(
284
- "libquickjs.a", os.path.join("quickjs", "libquickjs.a"))
285
-
286
- extra_objects = list(found_objects.values())
275
+ if local_sources:
276
+ build_c_objects(cc)
287
277
 
288
278
  libraries = ["pthread"]
289
279
  extra_link_args = []
@@ -292,13 +282,12 @@ def main(patched_func):
292
282
  import distutils.cygwinccompiler
293
283
 
294
284
  distutils.cygwinccompiler.get_msvcr = lambda: ["vcruntime140"]
295
- extra_objects = ["../pacparser.o", "../quickjs/libquickjs.a"]
296
285
  libraries = ["ws2_32"]
297
286
  extra_link_args = ["-static-libgcc", "-L" + python_home]
298
287
 
299
288
  pacparser_module = setuptools.Extension(
300
289
  "_pacparser",
301
- include_dirs=["..", "."],
290
+ include_dirs=include_dirs,
302
291
  sources=["pacparser_py.c"],
303
292
  libraries=libraries,
304
293
  extra_link_args=extra_link_args,
@@ -0,0 +1 @@
1
+ VERSION=1.5.3.dev2
@@ -1 +0,0 @@
1
- VERSION=1.5.3
File without changes
File without changes
File without changes
File without changes
File without changes