Skip to content

Commit 273f291

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

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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)