Skip to content

Commit a3b25ae

Browse files
committed
deprecate direct commandline scripts invocation and exclude nonsense ones
1 parent 14c0d73 commit a3b25ae

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ The table below shows which release corresponds to each branch, and what date th
7272
## 4.14.0 (`dev`)
7373

7474
- [#2356][2356] Add local libc database provider for libcdb
75+
- [#2364][2364] Deprecate direct commandline scripts invocation and exclude nonsense ones
7576

7677
[2356]: https://github.com/Gallopsled/pwntools/pull/2356
78+
[2364]: https://github.com/Gallopsled/pwntools/pull/2364
7779

7880
## 4.13.0 (`beta`)
7981

pwnlib/commandline/common.py

+7
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ def main(file=sys.argv[0]):
3030
name = os.path.splitext(os.path.basename(file))[0]
3131
sys.argv.insert(1, name)
3232
pwnlib.commandline.main.main()
33+
34+
def deprecated_main():
35+
file=sys.argv[0]
36+
name = os.path.splitext(os.path.basename(file))[0]
37+
import warnings
38+
warnings.warn("The '%s' command is deprecated and will be removed in a future version. Please use 'pwn %s' instead." % (name, name), DeprecationWarning, stacklevel=2)
39+
main(file)

setup.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
filename = os.path.basename(filename)
3636
filename, ext = os.path.splitext(filename)
3737

38-
if ext != '.py' or '__init__' in filename:
38+
if ext != '.py' or filename in ('__init__', 'common', 'main', 'update', 'version'):
3939
continue
4040

41-
script = '%s=pwnlib.commandline.common:main' % filename
41+
script = '%s=pwnlib.commandline.common:deprecated_main' % filename
4242
if not flag:
4343
console_scripts.append(script)
4444

@@ -78,6 +78,5 @@
7878
] + templates,
7979
},
8080
entry_points = {'console_scripts': console_scripts},
81-
scripts = glob.glob("bin/*"),
8281
**compat
8382
)

0 commit comments

Comments
 (0)