maxminddb 2.5.1__tar.gz → 2.5.2__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.
Files changed (92) hide show
  1. {maxminddb-2.5.1 → maxminddb-2.5.2}/HISTORY.rst +7 -0
  2. {maxminddb-2.5.1 → maxminddb-2.5.2}/MANIFEST.in +1 -0
  3. {maxminddb-2.5.1 → maxminddb-2.5.2}/PKG-INFO +1 -1
  4. {maxminddb-2.5.1 → maxminddb-2.5.2}/examples/benchmark.py +1 -1
  5. {maxminddb-2.5.1 → maxminddb-2.5.2}/extension/libmaxminddb/include/maxminddb.h +0 -2
  6. {maxminddb-2.5.1 → maxminddb-2.5.2}/extension/libmaxminddb/src/data-pool.c +1 -3
  7. {maxminddb-2.5.1 → maxminddb-2.5.2}/extension/libmaxminddb/src/data-pool.h +1 -0
  8. {maxminddb-2.5.1 → maxminddb-2.5.2}/extension/libmaxminddb/src/maxminddb.c +19 -6
  9. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/__init__.py +1 -1
  10. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb.egg-info/PKG-INFO +1 -1
  11. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb.egg-info/SOURCES.txt +0 -14
  12. {maxminddb-2.5.1 → maxminddb-2.5.2}/pyproject.toml +4 -1
  13. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/reader_test.py +1 -1
  14. maxminddb-2.5.1/.clang-format +0 -5
  15. maxminddb-2.5.1/.github/dependabot.yml +0 -11
  16. maxminddb-2.5.1/.github/workflows/address-sanitizer.yml +0 -37
  17. maxminddb-2.5.1/.github/workflows/clang-analyzer.yml +0 -38
  18. maxminddb-2.5.1/.github/workflows/codeql-analysis.yml +0 -54
  19. maxminddb-2.5.1/.github/workflows/release.yml +0 -64
  20. maxminddb-2.5.1/.github/workflows/test-libmaxminddb.yml +0 -57
  21. maxminddb-2.5.1/.github/workflows/test.yml +0 -40
  22. maxminddb-2.5.1/.gitignore +0 -24
  23. maxminddb-2.5.1/.gitmodules +0 -6
  24. maxminddb-2.5.1/.pylintrc +0 -4
  25. maxminddb-2.5.1/.readthedocs.yaml +0 -6
  26. maxminddb-2.5.1/dev-bin/clang-format-all.sh +0 -15
  27. maxminddb-2.5.1/dev-bin/release.sh +0 -65
  28. {maxminddb-2.5.1 → maxminddb-2.5.2}/LICENSE +0 -0
  29. {maxminddb-2.5.1 → maxminddb-2.5.2}/README.rst +0 -0
  30. {maxminddb-2.5.1 → maxminddb-2.5.2}/docs/Makefile +0 -0
  31. {maxminddb-2.5.1 → maxminddb-2.5.2}/docs/conf.py +0 -0
  32. {maxminddb-2.5.1 → maxminddb-2.5.2}/docs/index.rst +0 -0
  33. {maxminddb-2.5.1 → maxminddb-2.5.2}/extension/libmaxminddb/src/maxminddb-compat-util.h +0 -0
  34. {maxminddb-2.5.1 → maxminddb-2.5.2}/extension/maxminddb.c +0 -0
  35. {maxminddb-2.5.1 → maxminddb-2.5.2}/extension/maxminddb_config.h +0 -0
  36. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/const.py +0 -0
  37. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/decoder.py +0 -0
  38. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/errors.py +0 -0
  39. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/extension.pyi +0 -0
  40. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/file.py +0 -0
  41. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/py.typed +0 -0
  42. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/reader.py +0 -0
  43. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb/types.py +0 -0
  44. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb.egg-info/dependency_links.txt +0 -0
  45. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb.egg-info/requires.txt +0 -0
  46. {maxminddb-2.5.1 → maxminddb-2.5.2}/maxminddb.egg-info/top_level.txt +0 -0
  47. {maxminddb-2.5.1 → maxminddb-2.5.2}/setup.cfg +0 -0
  48. {maxminddb-2.5.1 → maxminddb-2.5.2}/setup.py +0 -0
  49. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/libmaxminddb/libmaxminddb-offset-integer-overflow.mmdb +0 -0
  50. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/maxminddb-golang/cyclic-data-structure.mmdb +0 -0
  51. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/maxminddb-golang/invalid-bytes-length.mmdb +0 -0
  52. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/maxminddb-golang/invalid-data-record-offset.mmdb +0 -0
  53. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/maxminddb-golang/invalid-map-key-length.mmdb +0 -0
  54. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/maxminddb-golang/invalid-string-length.mmdb +0 -0
  55. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/maxminddb-golang/metadata-is-an-uint128.mmdb +0 -0
  56. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/maxminddb-golang/unexpected-bytes.mmdb +0 -0
  57. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/bad-data/maxminddb-python/bad-unicode-in-map-key.mmdb +0 -0
  58. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
  59. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
  60. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
  61. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-City-Test.mmdb +0 -0
  62. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
  63. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-Country-Test.mmdb +0 -0
  64. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
  65. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-Domain-Test.mmdb +0 -0
  66. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
  67. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-ISP-Test.mmdb +0 -0
  68. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
  69. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-Static-IP-Score-Test.mmdb +0 -0
  70. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoIP2-User-Count-Test.mmdb +0 -0
  71. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoLite2-ASN-Test.mmdb +0 -0
  72. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoLite2-City-Test.mmdb +0 -0
  73. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/GeoLite2-Country-Test.mmdb +0 -0
  74. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
  75. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
  76. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
  77. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
  78. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
  79. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
  80. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
  81. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
  82. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
  83. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
  84. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
  85. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  86. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
  87. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
  88. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
  89. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-nested.mmdb +0 -0
  90. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/MaxMind-DB-test-pointer-decoder.mmdb +0 -0
  91. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/data/test-data/maps-with-pointers.raw +0 -0
  92. {maxminddb-2.5.1 → maxminddb-2.5.2}/tests/decoder_test.py +0 -0
@@ -3,6 +3,13 @@
3
3
  History
4
4
  -------
5
5
 
6
+ 2.5.2 (2024-01-09)
7
+ ++++++++++++++++++
8
+
9
+ * The vendored ``libmaxminddb`` version was updated to 1.9.0. This fixes
10
+ an issue when reading databases with a search tree exceeding 2 GB.
11
+ Reported by Sami Salonen. GitHub #146.
12
+
6
13
  2.5.1 (2023-11-09)
7
14
  ++++++++++++++++++
8
15
 
@@ -1,3 +1,4 @@
1
+ exclude .* .github/**/* dev-bin/*
1
2
  include HISTORY.rst README.rst LICENSE maxminddb/py.typed maxminddb/extension.pyi
2
3
  recursive-include extension/libmaxminddb/include *.h
3
4
  recursive-include extension/libmaxminddb/src *.c *.h
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maxminddb
3
- Version: 2.5.1
3
+ Version: 2.5.2
4
4
  Summary: Reader for the MaxMind DB format
5
5
  Author-email: Gregory Oschwald <goschwald@maxmind.com>
6
6
  License: Apache License, Version 2.0
@@ -30,4 +30,4 @@ elapsed = timeit.timeit(
30
30
  number=args.count,
31
31
  )
32
32
 
33
- print(args.count / elapsed, "lookups per second")
33
+ print("{:,}".format(int(args.count / elapsed)), "lookups per second")
@@ -17,8 +17,6 @@ extern "C" {
17
17
  #include <ws2tcpip.h>
18
18
  /* libmaxminddb package version from configure */
19
19
 
20
- typedef ADDRESS_FAMILY sa_family_t;
21
-
22
20
  #if defined(_MSC_VER)
23
21
  /* MSVC doesn't define signed size_t, copy it from configure */
24
22
  #define ssize_t SSIZE_T
@@ -9,8 +9,6 @@
9
9
  #include <stddef.h>
10
10
  #include <stdlib.h>
11
11
 
12
- static bool can_multiply(size_t const, size_t const, size_t const);
13
-
14
12
  // Allocate an MMDB_data_pool_s. It initially has space for size
15
13
  // MMDB_entry_data_list_s structs.
16
14
  MMDB_data_pool_s *data_pool_new(size_t const size) {
@@ -43,7 +41,7 @@ MMDB_data_pool_s *data_pool_new(size_t const size) {
43
41
  // the given max. max will typically be SIZE_MAX.
44
42
  //
45
43
  // We want to know if we'll wrap around.
46
- static bool can_multiply(size_t const max, size_t const m, size_t const n) {
44
+ bool can_multiply(size_t const max, size_t const m, size_t const n) {
47
45
  if (m == 0) {
48
46
  return false;
49
47
  }
@@ -44,6 +44,7 @@ typedef struct MMDB_data_pool_s {
44
44
  MMDB_entry_data_list_s *blocks[DATA_POOL_NUM_BLOCKS];
45
45
  } MMDB_data_pool_s;
46
46
 
47
+ bool can_multiply(size_t const, size_t const, size_t const);
47
48
  MMDB_data_pool_s *data_pool_new(size_t const);
48
49
  void data_pool_destroy(MMDB_data_pool_s *const);
49
50
  MMDB_entry_data_list_s *data_pool_alloc(MMDB_data_pool_s *const);
@@ -23,6 +23,8 @@
23
23
  #endif
24
24
  #include <windows.h>
25
25
  #include <ws2ipdef.h>
26
+ #define SSIZE_MAX INTPTR_MAX
27
+ typedef ADDRESS_FAMILY sa_family_t;
26
28
  #else
27
29
  #include <arpa/inet.h>
28
30
  #include <sys/mman.h>
@@ -288,18 +290,29 @@ int MMDB_open(const char *const filename, uint32_t flags, MMDB_s *const mmdb) {
288
290
  goto cleanup;
289
291
  }
290
292
 
291
- uint32_t search_tree_size =
292
- mmdb->metadata.node_count * mmdb->full_record_byte_size;
293
+ if (!can_multiply(SSIZE_MAX,
294
+ mmdb->metadata.node_count,
295
+ mmdb->full_record_byte_size)) {
296
+ status = MMDB_INVALID_METADATA_ERROR;
297
+ goto cleanup;
298
+ }
299
+ ssize_t search_tree_size = (ssize_t)mmdb->metadata.node_count *
300
+ (ssize_t)mmdb->full_record_byte_size;
293
301
 
294
302
  mmdb->data_section =
295
303
  mmdb->file_content + search_tree_size + MMDB_DATA_SECTION_SEPARATOR;
296
- if (search_tree_size + MMDB_DATA_SECTION_SEPARATOR >
297
- (uint32_t)mmdb->file_size) {
304
+ if (mmdb->file_size < MMDB_DATA_SECTION_SEPARATOR ||
305
+ search_tree_size > mmdb->file_size - MMDB_DATA_SECTION_SEPARATOR) {
306
+ status = MMDB_INVALID_METADATA_ERROR;
307
+ goto cleanup;
308
+ }
309
+ ssize_t data_section_size =
310
+ mmdb->file_size - search_tree_size - MMDB_DATA_SECTION_SEPARATOR;
311
+ if (data_section_size > UINT32_MAX || data_section_size <= 0) {
298
312
  status = MMDB_INVALID_METADATA_ERROR;
299
313
  goto cleanup;
300
314
  }
301
- mmdb->data_section_size = (uint32_t)mmdb->file_size - search_tree_size -
302
- MMDB_DATA_SECTION_SEPARATOR;
315
+ mmdb->data_section_size = (uint32_t)data_section_size;
303
316
 
304
317
  // Although it is likely not possible to construct a database with valid
305
318
  // valid metadata, as parsed above, and a data_section_size less than 3,
@@ -81,7 +81,7 @@ def open_database(
81
81
 
82
82
 
83
83
  __title__ = "maxminddb"
84
- __version__ = "2.5.1"
84
+ __version__ = "2.5.2"
85
85
  __author__ = "Gregory Oschwald"
86
86
  __license__ = "Apache License, Version 2.0"
87
87
  __copyright__ = "Copyright 2013-2023 MaxMind, Inc."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maxminddb
3
- Version: 2.5.1
3
+ Version: 2.5.2
4
4
  Summary: Reader for the MaxMind DB format
5
5
  Author-email: Gregory Oschwald <goschwald@maxmind.com>
6
6
  License: Apache License, Version 2.0
@@ -1,8 +1,3 @@
1
- .clang-format
2
- .gitignore
3
- .gitmodules
4
- .pylintrc
5
- .readthedocs.yaml
6
1
  HISTORY.rst
7
2
  LICENSE
8
3
  MANIFEST.in
@@ -10,15 +5,6 @@ README.rst
10
5
  pyproject.toml
11
6
  setup.cfg
12
7
  setup.py
13
- .github/dependabot.yml
14
- .github/workflows/address-sanitizer.yml
15
- .github/workflows/clang-analyzer.yml
16
- .github/workflows/codeql-analysis.yml
17
- .github/workflows/release.yml
18
- .github/workflows/test-libmaxminddb.yml
19
- .github/workflows/test.yml
20
- dev-bin/clang-format-all.sh
21
- dev-bin/release.sh
22
8
  docs/Makefile
23
9
  docs/conf.py
24
10
  docs/index.rst
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maxminddb"
7
- version = "2.5.1"
7
+ version = "2.5.2"
8
8
  description = "Reader for the MaxMind DB format"
9
9
  authors = [
10
10
  {name = "Gregory Oschwald", email = "goschwald@maxmind.com"},
@@ -38,6 +38,9 @@ Documentation = "https://maxminddb.readthedocs.org/"
38
38
  "Source Code" = "https://github.com/maxmind/MaxMind-DB-Reader-python"
39
39
  "Issue Tracker" = "https://github.com/maxmind/MaxMind-DB-Reader-python/issues"
40
40
 
41
+ [tool.setuptools.package-data]
42
+ maxminddb = ["py.typed"]
43
+
41
44
  [tool.black]
42
45
  # src is showing up in our GitHub linting builds. It seems to
43
46
  # contain deps.
@@ -675,7 +675,7 @@ class TestMemoryReader(BaseTestReader, unittest.TestCase):
675
675
 
676
676
  class TestFDReader(BaseTestReader, unittest.TestCase):
677
677
  def setUp(self):
678
- self.open_database_patcher = mock.patch("reader_test.open_database")
678
+ self.open_database_patcher = mock.patch(__name__ + ".open_database")
679
679
  self.addCleanup(self.open_database_patcher.stop)
680
680
  self.open_database = self.open_database_patcher.start()
681
681
  self.open_database.side_effect = get_reader_from_file_descriptor
@@ -1,5 +0,0 @@
1
- BasedOnStyle: LLVM
2
- IndentWidth: 4
3
- BinPackArguments: false
4
- BinPackParameters: false
5
- IndentCaseLabels: true
@@ -1,11 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: pip
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- open-pull-requests-limit: 10
8
- - package-ecosystem: "github-actions"
9
- directory: "/"
10
- schedule:
11
- interval: daily
@@ -1,37 +0,0 @@
1
- name: Run Address Sanitizer
2
- on:
3
- push:
4
- pull_request:
5
- schedule:
6
- - cron: '13 15 * * SUN'
7
- jobs:
8
- build:
9
- name: Address Sanitizer
10
- runs-on: ubuntu-latest
11
- env:
12
- ASAN_OPTIONS: strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_invalid_pointer_pairs=2:detect_leaks=0
13
- CC: clang
14
- CFLAGS: -fsanitize=address -Wall -Wextra -Wpedantic -Wformat=2 -Walloca -Wvla -Wimplicit-fallthrough -Wcast-qual -Wconversion -Wshadow -Wundef -Wstrict-prototypes -Wswitch-enum -fstack-protector -D_FORTIFY_SOURCE=2 -Werror
15
- LDFLAGS: -fsanitize=address
16
- steps:
17
- - name: Checkout
18
- uses: actions/checkout@v4
19
- with:
20
- submodules: true
21
-
22
- - name: Set up Python
23
- uses: actions/setup-python@v4
24
- with:
25
- python-version: 3.12
26
-
27
- - name: Install dependencies
28
- run: |
29
- python -m pip install --upgrade pip
30
- pip install setuptools tox tox-gh-actions wheel
31
-
32
- - name: Test with tox
33
- run: tox
34
- env:
35
- LD_PRELOAD: libasan.so.6
36
- MAXMINDDB_REQUIRE_EXTENSION: 1
37
- MM_FORCE_EXT_TESTS: 1
@@ -1,38 +0,0 @@
1
- name: Clang Static Analysis
2
-
3
- on:
4
- push:
5
- pull_request:
6
- schedule:
7
- - cron: '3 15 * * SUN'
8
-
9
- jobs:
10
- clang-analyzer:
11
- name: Clang Static Analysis
12
- runs-on: ubuntu-latest
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v4
16
- with:
17
- submodules: true
18
-
19
- - name: Install clang-tools
20
- run: sudo apt install clang-tools
21
-
22
- - name: Set up Python
23
- uses: actions/setup-python@v4
24
- with:
25
- python-version: 3.12
26
-
27
- - name: Install dependencies
28
- run: |
29
- python -m pip install --upgrade pip
30
- pip install setuptools wheel
31
-
32
- - name: Build and run analyzer
33
- # We exclude extension/libmaxminddb/ as libmaxminddb has its own workflow
34
- # for this and we are not able to correct any issues with that code here.
35
- run: scan-build --exclude extension/libmaxminddb/ --status-bugs python setup.py build
36
- env:
37
- CFLAGS: "-Werror -Wall -Wextra"
38
- MAXMINDDB_REQUIRE_EXTENSION: 1
@@ -1,54 +0,0 @@
1
- name: "Code scanning - action"
2
-
3
- on:
4
- push:
5
- branches-ignore:
6
- - 'dependabot/**'
7
- pull_request:
8
- schedule:
9
- - cron: '0 18 * * 0'
10
-
11
- jobs:
12
- CodeQL-Build:
13
-
14
- runs-on: ubuntu-latest
15
-
16
- steps:
17
- - name: Checkout repository
18
- uses: actions/checkout@v4
19
- with:
20
- # We must fetch at least the immediate parents so that if this is
21
- # a pull request then we can checkout the head.
22
- fetch-depth: 2
23
- submodules: true
24
-
25
- # If this run was triggered by a pull request event, then checkout
26
- # the head of the pull request instead of the merge commit.
27
- - run: git checkout HEAD^2
28
- if: ${{ github.event_name == 'pull_request' }}
29
-
30
- # Initializes the CodeQL tools for scanning.
31
- - name: Initialize CodeQL
32
- uses: github/codeql-action/init@v2
33
- # Override language selection by uncommenting this and choosing your languages
34
- with:
35
- languages: python, cpp
36
-
37
- # ℹ️ Command-line programs to run using the OS shell.
38
- # 📚 https://git.io/JvXDl
39
-
40
- # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
41
- # and modify them (or add more) to build your code if your project
42
- # uses a compiled language
43
-
44
- - name: Install dependencies
45
- run: |
46
- python -m pip install --upgrade pip
47
- pip install setuptools wheel
48
-
49
- - run: python setup.py build
50
- env:
51
- MAXMINDDB_REQUIRE_EXTENSION: 1
52
-
53
- - name: Perform CodeQL Analysis
54
- uses: github/codeql-action/analyze@v2
@@ -1,64 +0,0 @@
1
- name: Build and upload to PyPI
2
-
3
- on:
4
- workflow_dispatch:
5
- pull_request:
6
- push:
7
- branches:
8
- - main
9
- release:
10
- types:
11
- - published
12
-
13
- jobs:
14
- build_wheels:
15
- name: Build wheels on ${{ matrix.os }}
16
- runs-on: ${{ matrix.os }}
17
- strategy:
18
- matrix:
19
- os: [macos-latest, ubuntu-latest, windows-latest]
20
-
21
- steps:
22
- - uses: actions/checkout@v4
23
- with:
24
- submodules: true
25
-
26
- - name: Build wheels
27
- uses: pypa/cibuildwheel@v2.16.2
28
- env:
29
- CIBW_BUILD_VERBOSITY: 1
30
- MAXMINDDB_REQUIRE_EXTENSION: 1
31
-
32
- - uses: actions/upload-artifact@v3
33
- with:
34
- path: ./wheelhouse/*.whl
35
-
36
- build_sdist:
37
- name: Build source distribution
38
- runs-on: ubuntu-latest
39
- steps:
40
- - uses: actions/checkout@v4
41
- with:
42
- submodules: true
43
-
44
- - name: Build sdist
45
- run: pipx run build --sdist
46
-
47
- - uses: actions/upload-artifact@v3
48
- with:
49
- path: dist/*.tar.gz
50
-
51
- upload_pypi:
52
- needs: [build_wheels, build_sdist]
53
- runs-on: ubuntu-latest
54
- environment: release
55
- permissions:
56
- id-token: write
57
- if: github.event_name == 'release' && github.event.action == 'published'
58
- steps:
59
- - uses: actions/download-artifact@v3
60
- with:
61
- name: artifact
62
- path: dist
63
-
64
- - uses: pypa/gh-action-pypi-publish@release/v1
@@ -1,57 +0,0 @@
1
- name: Python tests (system libmaxminddb)
2
-
3
- on:
4
- push:
5
- pull_request:
6
- schedule:
7
- - cron: '3 15 * * SUN'
8
-
9
- jobs:
10
- build:
11
-
12
- strategy:
13
- matrix:
14
- # We don't test on Windows currently due to issues
15
- # build libmaxminddb there.
16
- platform: [macos-latest, ubuntu-latest]
17
- python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
18
-
19
- name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
20
- runs-on: ${{ matrix.platform }}
21
- env:
22
- MAXMINDDB_REQUIRE_EXTENSION: 1
23
- MAXMINDDB_USE_SYSTEM_LIBMAXMINDDB: 1
24
- MM_FORCE_EXT_TESTS: 1
25
-
26
- steps:
27
- - name: Checkout
28
- uses: actions/checkout@v4
29
- with:
30
- submodules: true
31
-
32
- - name: Set up Python ${{ matrix.python-version }}
33
- uses: actions/setup-python@v4
34
- with:
35
- python-version: ${{ matrix.python-version }}
36
-
37
- - name: Install dependencies
38
- run: |
39
- python -m pip install --upgrade pip
40
- pip install setuptools tox tox-gh-actions wheel
41
-
42
-
43
- - name: Install libmaxminddb
44
- run: sudo apt install libmaxminddb-dev
45
- if: matrix.platform == 'ubuntu-latest'
46
-
47
- - name: Install libmaxminddb
48
- run: brew install libmaxminddb
49
- if: matrix.platform == 'macos-latest'
50
-
51
- - name: Build with Werror and Wall
52
- run: python setup.py build
53
- env:
54
- CFLAGS: "-Werror -Wall -Wextra"
55
-
56
- - name: Test with tox (system libmaxminddb)
57
- run: tox
@@ -1,40 +0,0 @@
1
- name: Python tests
2
-
3
- on:
4
- push:
5
- pull_request:
6
- schedule:
7
- - cron: '3 15 * * SUN'
8
-
9
- jobs:
10
- build:
11
-
12
- strategy:
13
- matrix:
14
- platform: [macos-latest, ubuntu-latest, windows-latest]
15
- python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
16
-
17
- name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
18
- runs-on: ${{ matrix.platform }}
19
-
20
- steps:
21
- - name: Checkout
22
- uses: actions/checkout@v4
23
- with:
24
- submodules: true
25
-
26
- - name: Set up Python ${{ matrix.python-version }}
27
- uses: actions/setup-python@v4
28
- with:
29
- python-version: ${{ matrix.python-version }}
30
-
31
- - name: Install dependencies
32
- run: |
33
- python -m pip install --upgrade pip
34
- pip install tox tox-gh-actions
35
-
36
- - name: Test with tox (vendored libmaxminddb)
37
- run: tox
38
- env:
39
- MAXMINDDB_REQUIRE_EXTENSION: 1
40
- MM_FORCE_EXT_TESTS: 1
@@ -1,24 +0,0 @@
1
- *.egg
2
- *.iml
3
- *.pyc
4
- *.so
5
- *.sw?
6
- *~
7
- .coverage
8
- .eggs
9
- .idea
10
- .pyre
11
- .tox
12
- build
13
- compile_flags.txt
14
- core
15
- dist
16
- docs/_build
17
- docs/doctrees
18
- docs/html
19
- env/
20
- MANIFEST
21
- maxminddb.egg-info/
22
- pylint.txt
23
- valgrind-python.supp
24
- violations.pyflakes.txt
@@ -1,6 +0,0 @@
1
- [submodule "tests/data"]
2
- path = tests/data
3
- url = https://github.com/maxmind/MaxMind-DB
4
- [submodule "extension/libmaxminddb"]
5
- path = extension/libmaxminddb
6
- url = git@github.com:maxmind/libmaxminddb.git
maxminddb-2.5.1/.pylintrc DELETED
@@ -1,4 +0,0 @@
1
- [BASIC]
2
-
3
- no-docstring-rgx=_.*
4
- extension-pkg-allow-list=maxminddb.extension
@@ -1,6 +0,0 @@
1
- version: 2
2
-
3
- build:
4
- os: ubuntu-22.04
5
- tools:
6
- python: "3.12"
@@ -1,15 +0,0 @@
1
- #!/bin/sh
2
-
3
- format="clang-format -i -style=file"
4
-
5
- for dir in extension; do
6
- c_files=`find $dir -maxdepth 1 -name '*.c'`
7
- if [ "$c_files" != "" ]; then
8
- $format $dir/*.c;
9
- fi
10
-
11
- h_files=`find $dir -maxdepth 1 -name '*.h'`
12
- if [ "$h_files" != "" ]; then
13
- $format $dir/*.h;
14
- fi
15
- done
@@ -1,65 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -eu -o pipefail
4
-
5
- pip install twine sphinx
6
-
7
- changelog=$(cat HISTORY.rst)
8
-
9
- regex='
10
- ([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
11
- \+*
12
-
13
- ((.|
14
- )*)
15
- '
16
-
17
- if [[ ! $changelog =~ $regex ]]; then
18
- echo "Could not find date line in change log!"
19
- exit 1
20
- fi
21
-
22
- version="${BASH_REMATCH[1]}"
23
- date="${BASH_REMATCH[2]}"
24
- notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^[0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
25
-
26
- if [[ "$date" != $(date +"%Y-%m-%d") ]]; then
27
- echo "$date is not today!"
28
- exit 1
29
- fi
30
-
31
- tag="v$version"
32
-
33
- if [ -n "$(git status --porcelain)" ]; then
34
- echo ". is not clean." >&2
35
- exit 1
36
- fi
37
-
38
- perl -pi -e "s/(?<=__version__ = \").+?(?=\")/$version/gsm" maxminddb/__init__.py
39
- perl -pi -e "s/(?<=^version = \").+?(?=\")/$version/gsm" pyproject.toml
40
-
41
- echo $"Test results:"
42
- tox
43
-
44
- echo $'\nDiff:'
45
- git diff
46
-
47
- echo $'\nRelease notes:'
48
- echo "$notes"
49
-
50
- read -e -p "Commit changes and push to origin? " should_push
51
-
52
- if [ "$should_push" != "y" ]; then
53
- echo "Aborting"
54
- exit 1
55
- fi
56
-
57
- if [ -n "$(git status --porcelain)" ]; then
58
- git commit -m "Update for $tag" -a
59
- fi
60
-
61
- git push
62
-
63
- gh release create --target "$(git branch --show-current)" -t "$version" -n "$notes" "$tag"
64
-
65
- git push --tags
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes