Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 May 2023 06:54:11 GMT
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 3d36384ab145 - main - net-p2p/py-ed2k-tools: some last minute style and commentary/spelling fixes.
Message-ID:  <202305210654.34L6sBd5027471@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3d36384ab1450949d189284b6d3fcf005f8b3b81

commit 3d36384ab1450949d189284b6d3fcf005f8b3b81
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2023-05-21 06:53:52 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2023-05-21 06:53:52 +0000

    net-p2p/py-ed2k-tools: some last minute style and commentary/spelling fixes.
---
 net-p2p/py-ed2k-tools/files/patch-fix__sofar.py    |  2 +-
 net-p2p/py-ed2k-tools/files/patch-make__met.py     |  4 ++--
 net-p2p/py-ed2k-tools/files/patch-temp__summary.py | 13 ++++++++-----
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/net-p2p/py-ed2k-tools/files/patch-fix__sofar.py b/net-p2p/py-ed2k-tools/files/patch-fix__sofar.py
index a7c4e293e4ab..927f2e52d1fa 100644
--- a/net-p2p/py-ed2k-tools/files/patch-fix__sofar.py
+++ b/net-p2p/py-ed2k-tools/files/patch-fix__sofar.py
@@ -28,7 +28,7 @@
 +		print("If you want to create new .met files with this 'bug' corrected, run this")
 +		print("program with the affected .met files as the command line arguments.  You")
 +		print("will get new .met files titled X.new, where X was the original .part.met")
-+		print("file.  Copy these over the top of your originals if you're sure thats what")
++		print("file.  Copy these over the top of your originals if you're sure that's what")
 +		print("you want to do.")
 +		print()
 +		print("Of course, Overnet will re-break these files on its next exit.  You'll")
diff --git a/net-p2p/py-ed2k-tools/files/patch-make__met.py b/net-p2p/py-ed2k-tools/files/patch-make__met.py
index 6bd11fea1491..07b23a50d9fb 100644
--- a/net-p2p/py-ed2k-tools/files/patch-make__met.py
+++ b/net-p2p/py-ed2k-tools/files/patch-make__met.py
@@ -18,7 +18,7 @@
 +		print("argument, which represents the ed2k:// link provided as the second arg.")
 +		print()
 +		print("Useful for adding things to your download list without actually opening")
-+		print("Overnet / Donkey.")
++		print("Overnet/eDonkey2000.")
  		sys.exit( -1 );
  	
  	temp_dir = sys.argv[ 1 ];
@@ -40,7 +40,7 @@
  	# Convert the printed hash into a byte representation.
  	# Surely there's an easier way to do this.
 -	new_hash = "";	
-+	new_hash = b''
++	new_hash = b""
  	while hash:
  		part = hash[ 0 : 2 ];
  		hash = hash[ 2 : ];
diff --git a/net-p2p/py-ed2k-tools/files/patch-temp__summary.py b/net-p2p/py-ed2k-tools/files/patch-temp__summary.py
index 8d100fd34870..46e7db596279 100644
--- a/net-p2p/py-ed2k-tools/files/patch-temp__summary.py
+++ b/net-p2p/py-ed2k-tools/files/patch-temp__summary.py
@@ -50,7 +50,7 @@
  		
  		# Set the total downloaded to the file size.
  		down = size;
-@@ -71,19 +66,39 @@ if __name__ == "__main__":
+@@ -71,19 +66,42 @@ if __name__ == "__main__":
  		bar = "#" * ( WIDTH - 2 );
  		for gap in gaps:
  			gap_start, gap_end = gaps[ gap ];
@@ -60,7 +60,7 @@
 +			char_gap_end = int(gap_end / bytes_per_char)
  			bar = bar[ : char_gap_start ] + " " * ( char_gap_end - char_gap_start ) + bar[ char_gap_end : ];
 +
-+		# Account for CJK characters occupy two terminal spaces
++		# Account for CJK characters occupy two fixed-width spaces.
 +		def char_width(c: str) -> int:
 +			if not c.isprintable(): return 0
 +			return 2 if unicodedata.category(c) == 'Lo' else 1
@@ -68,15 +68,18 @@
 +		def visible_len(s: str) -> int:
 +			return sum(char_width(c) for c in s)
 +
++		# Truncate string to specified limit.  If truncation happens
++		# on double-width character (like it would have to be cut in
++		# half), append an extra space for nicer alignment.
 +		def visible_substr_padded(s: str, l: int) -> str:
 +			vislen = 0
 +			cut_here = 0
 +			padding = ''
 +			for c in s:
 +				vislen += char_width(c)
-+				if (vislen <= l): cut_here += 1
-+				if (vislen == l): break
-+				if (vislen > l): padding = ' '; break
++				if vislen <= l: cut_here += 1
++				if vislen == l: break
++				if vislen > l: padding = ' '; break
 +			return s[:cut_here] + padding
  				
  		# Print out our summary.  Limit the filenames.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202305210654.34L6sBd5027471>