From 93643af066816aca4eb5815ce9a0f9c1ac30f65e Mon Sep 17 00:00:00 2001 From: Travis LaGrone Date: Thu, 11 Dec 2025 19:52:16 -0600 Subject: [PATCH] Support CLI on Windows by refactoring scripts to console_scripts --- jsonpatch.py => jsonpatch/__init__.py | 0 bin/jsondiff => jsonpatch/_jsondiff_cli.py | 0 bin/jsonpatch => jsonpatch/_jsonpatch_cli.py | 0 setup.py | 17 ++++++++++++----- 4 files changed, 12 insertions(+), 5 deletions(-) rename jsonpatch.py => jsonpatch/__init__.py (100%) rename bin/jsondiff => jsonpatch/_jsondiff_cli.py (100%) mode change 100755 => 100644 rename bin/jsonpatch => jsonpatch/_jsonpatch_cli.py (100%) mode change 100755 => 100644 diff --git a/jsonpatch.py b/jsonpatch/__init__.py similarity index 100% rename from jsonpatch.py rename to jsonpatch/__init__.py diff --git a/bin/jsondiff b/jsonpatch/_jsondiff_cli.py old mode 100755 new mode 100644 similarity index 100% rename from bin/jsondiff rename to jsonpatch/_jsondiff_cli.py diff --git a/bin/jsonpatch b/jsonpatch/_jsonpatch_cli.py old mode 100755 new mode 100644 similarity index 100% rename from bin/jsonpatch rename to jsonpatch/_jsonpatch_cli.py diff --git a/setup.py b/setup.py index ab9f32a..dd5945c 100644 --- a/setup.py +++ b/setup.py @@ -10,15 +10,17 @@ from distutils.core import setup has_setuptools = False -src = io.open('jsonpatch.py', encoding='utf-8').read() +src = io.open('jsonpatch/__init__.py', encoding='utf-8').read() metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", src)) docstrings = re.findall('"""([^"]*)"""', src, re.MULTILINE | re.DOTALL) PACKAGE = 'jsonpatch' -MODULES = ( - 'jsonpatch', -) +MODULES = [ + 'jsonpatch', + 'jsonpatch._jsondiff_cli', + 'jsonpatch._jsonpatch_cli', +] REQUIREMENTS = list(open('requirements.txt')) @@ -79,7 +81,12 @@ url=WEBSITE, py_modules=MODULES, package_data={'': ['requirements.txt']}, - scripts=['bin/jsondiff', 'bin/jsonpatch'], + entry_points={ + 'console_scripts': [ + 'jsondiff = jsonpatch._jsondiff_cli:main', + 'jsonpatch = jsonpatch._jsonpatch_cli:main', + ] + }, classifiers=CLASSIFIERS, python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*', project_urls={