XYZ File Manager
Current Path:
/usr/bin
usr
/
bin
/
📁
..
📁
X11
📄
[
(66.89 KB)
📄
ab
(58.42 KB)
📄
addpart
(30.31 KB)
📄
apt
(18.31 KB)
📄
apt-cache
(86.38 KB)
📄
apt-cdrom
(22.38 KB)
📄
apt-config
(26.31 KB)
📄
apt-get
(50.38 KB)
📄
apt-key
(27.32 KB)
📄
apt-mark
(58.38 KB)
📄
arch
(42.86 KB)
📄
awk
(154.66 KB)
📄
b2sum
(58.98 KB)
📄
base32
(46.89 KB)
📄
base64
(46.89 KB)
📄
basename
(42.83 KB)
📄
basenc
(54.89 KB)
📄
bash
(1.21 MB)
📄
bashbug
(6.7 KB)
📄
bdftopcf
(42.45 KB)
📄
bdftruncate
(10.22 KB)
📄
busctl
(90.5 KB)
📄
c_rehash
(6.68 KB)
📄
captoinfo
(90.34 KB)
📄
cat
(42.98 KB)
📄
certbot
(958 B)
📄
chage
(78.49 KB)
📄
chardet
(221 B)
📄
chardetect
(221 B)
📄
chattr
(14.24 KB)
📄
chcon
(67.11 KB)
📄
checkgid
(14.23 KB)
📄
chfn
(61.2 KB)
📄
chgrp
(67.05 KB)
📄
chmod
(62.98 KB)
📄
choom
(54.31 KB)
📄
chown
(71.05 KB)
📄
chrt
(66.31 KB)
📄
chsh
(51.64 KB)
📄
cksum
(139.05 KB)
📄
clear
(14.24 KB)
📄
clear_console
(14.15 KB)
📄
cmp
(50.95 KB)
📄
comm
(46.92 KB)
📄
corelist
(15.01 KB)
📄
cp
(147.61 KB)
📄
cpan
(8.16 KB)
📄
cpan5.36-x86_64-linux-gnu
(8.18 KB)
📄
csplit
(119.17 KB)
📄
ctstat
(26.59 KB)
📄
cut
(46.98 KB)
📄
dash
(122.7 KB)
📄
date
(119.05 KB)
📄
dbus-cleanup-sockets
(14.22 KB)
📄
dbus-daemon
(238.56 KB)
📄
dbus-monitor
(26.23 KB)
📄
dbus-run-session
(14.23 KB)
📄
dbus-send
(30.22 KB)
📄
dbus-update-activation-environment
(14.22 KB)
📄
dbus-uuidgen
(14.22 KB)
📄
dd
(87.15 KB)
📄
deb-systemd-helper
(23.79 KB)
📄
deb-systemd-invoke
(6.09 KB)
📄
debconf
(2.79 KB)
📄
debconf-apt-progress
(11.27 KB)
📄
debconf-communicate
(608 B)
📄
debconf-copydb
(1.68 KB)
📄
debconf-escape
(647 B)
📄
debconf-set-selections
(2.92 KB)
📄
debconf-show
(1.78 KB)
📄
delpart
(30.31 KB)
📄
df
(99.8 KB)
📄
dialog
(247.85 KB)
📄
diff
(151.58 KB)
📄
diff3
(67.14 KB)
📄
dir
(147.8 KB)
📄
dircolors
(50.92 KB)
📄
dirname
(38.83 KB)
📄
dmesg
(86.58 KB)
📄
dnsdomainname
(22.15 KB)
📄
domainname
(22.15 KB)
📄
dpkg
(310.64 KB)
📄
dpkg-deb
(166.52 KB)
📄
dpkg-divert
(154.55 KB)
📄
dpkg-maintscript-helper
(20.71 KB)
📄
dpkg-query
(158.58 KB)
📄
dpkg-realpath
(4.09 KB)
📄
dpkg-split
(126.48 KB)
📄
dpkg-statoverride
(62.33 KB)
📄
dpkg-trigger
(86.48 KB)
📄
du
(171.33 KB)
📄
dvipdf
(1007 B)
📄
echo
(42.83 KB)
📄
editor
(3.48 MB)
📄
egrep
(41 B)
📄
enc2xs
(40.96 KB)
📄
encguess
(3 KB)
📄
env
(47.4 KB)
📄
eps2eps
(639 B)
📄
ex
(3.48 MB)
📄
expand
(42.92 KB)
📄
expiry
(30.45 KB)
📄
expr
(115.05 KB)
📄
factor
(83.2 KB)
📄
faillog
(22.53 KB)
📄
fallocate
(34.31 KB)
📄
false
(34.83 KB)
📄
fcgistarter
(14.23 KB)
📄
fgrep
(41 B)
📄
fincore
(34.36 KB)
📄
find
(219.58 KB)
📄
findmnt
(83.59 KB)
📄
flock
(34.39 KB)
📄
fmt
(46.89 KB)
📄
fold
(42.89 KB)
📄
fonttosfnt
(34.41 KB)
📄
free
(26.3 KB)
📄
fuser
(39.83 KB)
📄
getconf
(26.5 KB)
📄
getent
(35.47 KB)
📄
getopt
(34.31 KB)
📄
ghostscript
(14.23 KB)
📄
gpasswd
(86.42 KB)
📄
gpgv
(463 KB)
📄
grep
(198.39 KB)
📄
groups
(42.89 KB)
📄
gs
(14.23 KB)
📄
gsbj
(350 B)
📄
gsdj
(352 B)
📄
gsdj500
(352 B)
📄
gslj
(353 B)
📄
gslp
(350 B)
📄
gsnd
(277 B)
📄
gunzip
(2.29 KB)
📄
gzexe
(6.3 KB)
📄
gzip
(95.84 KB)
📄
h2ph
(28.54 KB)
📄
h2xs
(59.51 KB)
📄
hardlink
(50.39 KB)
📄
head
(46.95 KB)
📄
helpztags
(2.46 KB)
📄
hostid
(38.83 KB)
📄
hostname
(22.15 KB)
📄
hostnamectl
(30.38 KB)
📄
htcacheclean
(34.24 KB)
📄
htdbm
(26.23 KB)
📄
htdigest
(14.23 KB)
📄
htpasswd
(26.23 KB)
📄
i386
(26.58 KB)
📄
iconv
(63.13 KB)
📄
id
(47.02 KB)
📄
infocmp
(62.31 KB)
📄
infotocap
(90.34 KB)
📄
install
(155.8 KB)
📄
instmodsh
(4.27 KB)
📄
ionice
(34.31 KB)
📄
ip
(674.82 KB)
📄
ipcmk
(34.38 KB)
📄
ipcrm
(34.31 KB)
📄
ipcs
(74.31 KB)
📄
ischroot
(14.32 KB)
📄
join
(54.98 KB)
📄
journalctl
(74.64 KB)
📄
json_pp
(4.88 KB)
📄
kernel-install
(12.75 KB)
📄
kill
(22.3 KB)
📄
killall
(31.95 KB)
📄
last
(50.31 KB)
📄
lastb
(50.31 KB)
📄
lastlog
(31.75 KB)
📄
lcf
(7.6 KB)
📄
ld.so
(205.96 KB)
📄
ldd
(5.28 KB)
📄
letsencrypt
(958 B)
📄
libnetcfg
(15.41 KB)
📄
link
(38.83 KB)
📄
linux32
(26.58 KB)
📄
linux64
(26.58 KB)
📄
ln
(71.12 KB)
📄
lnstat
(26.59 KB)
📄
locale
(46.16 KB)
📄
localectl
(26.38 KB)
📄
localedef
(291.91 KB)
📄
logger
(54.9 KB)
📄
login
(51.78 KB)
📄
loginctl
(58.48 KB)
📄
logname
(38.83 KB)
📄
logresolve
(14.24 KB)
📄
ls
(147.8 KB)
📄
lsattr
(14.24 KB)
📄
lsb_release
(2.59 KB)
📄
lsblk
(202.31 KB)
📄
lscpu
(126.31 KB)
📄
lsfd
(120.3 KB)
📄
lsipc
(98.31 KB)
📄
lsirq
(34.48 KB)
📄
lslocks
(70.7 KB)
📄
lslogins
(94.31 KB)
📄
lsmem
(66.31 KB)
📄
lsns
(82.31 KB)
📄
mawk
(154.66 KB)
📄
mcookie
(34.38 KB)
📄
md5sum
(50.95 KB)
📄
md5sum.textutils
(50.95 KB)
📄
mesg
(18.3 KB)
📄
mkdir
(95.27 KB)
📄
mkfifo
(67.17 KB)
📄
mkfontdir
(65 B)
📄
mkfontscale
(39.05 KB)
📄
mknod
(71.2 KB)
📄
mktemp
(42.92 KB)
📄
more
(58.31 KB)
📄
mount
(58.3 KB)
📄
mountpoint
(18.3 KB)
📄
mv
(139.62 KB)
📄
namei
(34.31 KB)
📄
nawk
(154.66 KB)
📄
netstat
(151.66 KB)
📄
networkctl
(106.38 KB)
📄
newgrp
(47.75 KB)
📄
nice
(42.86 KB)
📄
nisdomainname
(22.15 KB)
📄
nl
(111.11 KB)
📄
nohup
(42.89 KB)
📄
normalizer
(244 B)
📄
nproc
(42.89 KB)
📄
nsenter
(34.54 KB)
📄
nstat
(104.45 KB)
📄
numfmt
(67.02 KB)
📄
od
(79.02 KB)
📄
openssl
(953.26 KB)
📄
pager
(58.31 KB)
📄
paperconf
(14.34 KB)
📄
partx
(118.31 KB)
📄
passwd
(66.65 KB)
📄
paste
(42.89 KB)
📄
pathchk
(42.86 KB)
📄
pdb3
(62.4 KB)
📄
pdb3.11
(62.4 KB)
📄
pdf2dsc
(698 B)
📄
pdf2ps
(909 B)
📄
peekfd
(14.5 KB)
📄
perl
(3.63 MB)
📄
perl5.36-x86_64-linux-gnu
(14.41 KB)
📄
perl5.36.0
(3.63 MB)
📄
perlbug
(44.12 KB)
📄
perldoc
(125 B)
📄
perlivp
(10.61 KB)
📄
perlthanks
(44.12 KB)
📄
pf2afm
(498 B)
📄
pfbtopfa
(516 B)
📄
pgrep
(34.42 KB)
📄
phar
(14.88 KB)
📄
phar.phar
(14.88 KB)
📄
phar.phar8.2
(14.88 KB)
📄
phar8.2
(14.88 KB)
📄
phar8.2.phar
(14.88 KB)
📄
php
(5.4 MB)
📄
php8.2
(5.4 MB)
📄
piconv
(8.16 KB)
📄
pidof
(26.31 KB)
📄
pidwait
(34.42 KB)
📄
pinky
(47.05 KB)
📄
pkill
(34.42 KB)
📄
pl2pm
(4.43 KB)
📄
pldd
(22.69 KB)
📄
pmap
(34.34 KB)
📄
pod2html
(4.04 KB)
📄
pod2man
(14.68 KB)
📄
pod2text
(10.55 KB)
📄
pod2usage
(4.01 KB)
📄
podchecker
(3.57 KB)
📄
pphs
(404 B)
📄
pr
(79.11 KB)
📄
printafm
(395 B)
📄
printenv
(34.83 KB)
📄
printf
(62.92 KB)
📄
prlimit
(38.83 KB)
📄
prove
(13.34 KB)
📄
prtstat
(18.57 KB)
📄
ps
(142.93 KB)
📄
ps2ascii
(631 B)
📄
ps2epsi
(1.23 KB)
📄
ps2pdf
(272 B)
📄
ps2pdf12
(215 B)
📄
ps2pdf13
(215 B)
📄
ps2pdf14
(215 B)
📄
ps2pdfwr
(1.05 KB)
📄
ps2ps
(647 B)
📄
ps2ps2
(669 B)
📄
ps2txt
(631 B)
📄
pslog
(14.45 KB)
📄
pstree
(35.78 KB)
📄
pstree.x11
(35.78 KB)
📄
ptar
(3.48 KB)
📄
ptardiff
(2.58 KB)
📄
ptargrep
(4.29 KB)
📄
ptx
(135.23 KB)
📄
pwd
(42.92 KB)
📄
pwdx
(14.3 KB)
📄
py3clean
(7.63 KB)
📄
py3compile
(13 KB)
📄
py3versions
(12.52 KB)
📄
pydoc3
(79 B)
📄
pydoc3.11
(79 B)
📄
pygettext3
(23.67 KB)
📄
pygettext3.11
(23.67 KB)
📄
python3
(6.52 MB)
📄
python3.11
(6.52 MB)
📄
rbash
(1.21 MB)
📄
rdma
(180.6 KB)
📄
readlink
(50.89 KB)
📄
realpath
(50.92 KB)
📄
rename.ul
(22.3 KB)
📄
renice
(14.3 KB)
📄
reset
(30.24 KB)
📄
resizepart
(70.31 KB)
📄
rev
(14.3 KB)
📄
rgrep
(30 B)
📄
rm
(71.05 KB)
📄
rmdir
(54.92 KB)
📄
rotatelogs
(26.31 KB)
📄
routel
(1.62 KB)
📄
rtstat
(26.59 KB)
📄
run-parts
(26.91 KB)
📄
runcon
(42.95 KB)
📄
rview
(3.48 MB)
📄
rvim
(3.48 MB)
📄
savelog
(10.24 KB)
📄
scp
(266.63 KB)
📄
script
(70.3 KB)
📄
scriptlive
(54.3 KB)
📄
scriptreplay
(46.3 KB)
📄
sdiff
(55.08 KB)
📄
sed
(123.46 KB)
📄
select-editor
(2.39 KB)
📄
sensible-browser
(1.26 KB)
📄
sensible-editor
(1.24 KB)
📄
sensible-pager
(565 B)
📄
seq
(58.92 KB)
📄
setarch
(26.58 KB)
📄
setpriv
(78.31 KB)
📄
setsid
(14.3 KB)
📄
setterm
(46.31 KB)
📄
sftp
(282.59 KB)
📄
sg
(47.75 KB)
📄
sh
(122.7 KB)
📄
sha1sum
(54.95 KB)
📄
sha224sum
(58.95 KB)
📄
sha256sum
(58.95 KB)
📄
sha384sum
(62.95 KB)
📄
sha512sum
(62.95 KB)
📄
shasum
(9.75 KB)
📄
shred
(63.14 KB)
📄
shuf
(58.98 KB)
📄
skill
(30.33 KB)
📄
slabtop
(22.37 KB)
📄
sleep
(42.86 KB)
📄
slogin
(1.07 MB)
📄
snice
(30.33 KB)
📄
sort
(115.68 KB)
📄
splain
(18.99 KB)
📄
split
(59.55 KB)
📄
ss
(189.14 KB)
📄
ssh
(1.07 MB)
📄
ssh-add
(518.44 KB)
📄
ssh-agent
(474.38 KB)
📄
ssh-argv0
(1.42 KB)
📄
ssh-copy-id
(12.38 KB)
📄
ssh-keygen
(646.44 KB)
📄
ssh-keyscan
(622.47 KB)
📄
stat
(95.2 KB)
📄
stdbuf
(58.92 KB)
📄
streamzip
(7.75 KB)
📄
stty
(83.02 KB)
📄
su
(70.31 KB)
📄
sum
(50.96 KB)
📄
sync
(38.89 KB)
📄
systemctl
(1.29 MB)
📄
systemd
(90.38 KB)
📄
systemd-analyze
(182.61 KB)
📄
systemd-ask-password
(18.48 KB)
📄
systemd-cat
(18.38 KB)
📄
systemd-cgls
(22.48 KB)
📄
systemd-cgtop
(38.4 KB)
📄
systemd-creds
(42.61 KB)
📄
systemd-cryptenroll
(58.6 KB)
📄
systemd-delta
(26.38 KB)
📄
systemd-detect-virt
(18.37 KB)
📄
systemd-escape
(18.37 KB)
📄
systemd-firstboot
(50.59 KB)
📄
systemd-id128
(22.37 KB)
📄
systemd-inhibit
(22.39 KB)
📄
systemd-machine-id-setup
(18.48 KB)
📄
systemd-mount
(50.59 KB)
📄
systemd-notify
(18.38 KB)
📄
systemd-path
(18.37 KB)
📄
systemd-repart
(150.69 KB)
📄
systemd-run
(58.57 KB)
📄
systemd-socket-activate
(26.38 KB)
📄
systemd-stdio-bridge
(18.38 KB)
📄
systemd-sysext
(42.49 KB)
📄
systemd-sysusers
(62.68 KB)
📄
systemd-tmpfiles
(110.57 KB)
📄
systemd-tty-ask-password-agent
(34.38 KB)
📄
systemd-umount
(50.59 KB)
📄
tabs
(18.23 KB)
📄
tac
(111.05 KB)
📄
tail
(75.14 KB)
📄
tar
(519.52 KB)
📄
taskset
(62.31 KB)
📄
tee
(42.95 KB)
📄
tempfile
(14.18 KB)
📄
test
(58.89 KB)
📄
tic
(90.34 KB)
📄
timedatectl
(42.37 KB)
📄
timeout
(47.49 KB)
📄
tload
(18.32 KB)
📄
toe
(22.23 KB)
📄
top
(131.58 KB)
📄
touch
(107.05 KB)
📄
tput
(26.27 KB)
📄
tr
(54.89 KB)
📄
true
(34.83 KB)
📄
truncate
(42.89 KB)
📄
tset
(30.24 KB)
📄
tsort
(54.89 KB)
📄
tty
(34.86 KB)
📄
tzselect
(14.99 KB)
📄
ucf
(40.69 KB)
📄
ucfq
(18.91 KB)
📄
ucfr
(10.85 KB)
📄
uclampset
(62.31 KB)
📄
ucs2any
(18.32 KB)
📄
umount
(34.3 KB)
📄
uname
(42.86 KB)
📄
uncompress
(2.29 KB)
📄
unexpand
(42.92 KB)
📄
uniq
(46.95 KB)
📄
unlink
(38.83 KB)
📄
unshare
(82.54 KB)
📄
update-alternatives
(58.31 KB)
📄
update-mime-database
(59.27 KB)
📄
uptime
(14.3 KB)
📄
users
(38.89 KB)
📄
utmpdump
(30.3 KB)
📄
vdir
(147.8 KB)
📄
vi
(3.48 MB)
📄
view
(3.48 MB)
📄
vim
(3.48 MB)
📄
vim.basic
(3.48 MB)
📄
vimdiff
(3.48 MB)
📄
vimtutor
(2.1 KB)
📄
vmstat
(34.72 KB)
📄
w
(22.3 KB)
📄
wall
(38.3 KB)
📄
watch
(26.71 KB)
📄
wc
(51.05 KB)
📄
wdctl
(70.34 KB)
📄
wget
(527.36 KB)
📄
whereis
(30.77 KB)
📄
which
(946 B)
📄
which.debianutils
(946 B)
📄
who
(59.02 KB)
📄
whoami
(38.86 KB)
📄
x86_64
(26.58 KB)
📄
xargs
(70.45 KB)
📄
xdg-user-dir
(234 B)
📄
xdg-user-dirs-update
(26.16 KB)
📄
xsubpp
(5.05 KB)
📄
xxd
(18.21 KB)
📄
yes
(38.83 KB)
📄
ypdomainname
(22.15 KB)
📄
zcat
(1.94 KB)
📄
zcmp
(1.64 KB)
📄
zdiff
(6.31 KB)
📄
zdump
(22.52 KB)
📄
zegrep
(29 B)
📄
zfgrep
(29 B)
📄
zforce
(2.03 KB)
📄
zgrep
(7.91 KB)
📄
zipdetails
(68.55 KB)
📄
zless
(2.15 KB)
📄
zmore
(1.8 KB)
📄
znew
(4.47 KB)
Editing: py3versions
#! /usr/bin/python3 import os import re import sys _defaults = None _old_versions = None _unsupported_versions = None _supported_versions = ["python%s" % ver.strip() for ver in os.environ.get('DEBPYTHON3_SUPPORTED', '').split(',') if ver.strip()] #_default_version = "python%s" % os.environ.get('DEBPYTHON3_DEFAULT', '') #if _default_version == 'python': # _default_version = None _default_version = None def read_default(name=None): global _defaults from configparser import ConfigParser, NoOptionError if not _defaults: if os.path.exists('/usr/share/python3/debian_defaults'): config = ConfigParser() defaultsfile = open('/usr/share/python3/debian_defaults') config.read_file(defaultsfile) defaultsfile.close() _defaults = config if _defaults and name: try: value = _defaults.get('DEFAULT', name) except NoOptionError: raise ValueError return value return None def version_to_tuple(version): return tuple(int(part) for part in version.split('.')) def parse_versions(vstring): if len(vstring.split(',')) > 2: raise ValueError('too many arguments provided for X-Python3-Version: min and max only.') import operator operators = {None: operator.eq, '=': operator.eq, '>=': operator.ge, '<=': operator.le, '<<': operator.lt} vinfo = {} exact_versions = set() version_range = set(supported_versions(version_only=True)) relop_seen = False for field in vstring.split(','): field = field.strip() if field == 'all': continue if field in ('current', 'current_ext'): continue vinfo.setdefault('versions', set()) ve = re.compile(r'(>=|<=|<<|=)? *(\d\.\d+)$') m = ve.match(field) try: if not m: raise ValueError('error parsing Python3-Version attribute') op, v = m.group(1), m.group(2) vmaj, vmin = v.split('.') if int(vmaj) < 3: continue if op in (None, '='): exact_versions.add(v) else: relop_seen = True filtop = operators[op] version_range = [av for av in version_range if filtop( version_to_tuple(av), version_to_tuple(v))] except Exception: raise ValueError('error parsing Python3-Version attribute') if 'versions' in vinfo: vinfo['versions'] = exact_versions if relop_seen: vinfo['versions'] = exact_versions.union(version_range) return vinfo def old_versions(version_only=False): global _old_versions if not _old_versions: try: value = read_default('old-versions') _old_versions = [s.strip() for s in value.split(',')] except ValueError: _old_versions = [] if version_only: return [v[6:] for v in _old_versions] else: return _old_versions def unsupported_versions(version_only=False): global _unsupported_versions if not _unsupported_versions: try: value = read_default('unsupported-versions') _unsupported_versions = [s.strip() for s in value.split(',')] except ValueError: _unsupported_versions = [] if version_only: return [v[6:] for v in _unsupported_versions] else: return _unsupported_versions def supported_versions(version_only=False): global _supported_versions,_default_version default_version() if not _supported_versions: try: value = read_default('supported-versions') _supported_versions = [s.strip() for s in value.split(',')] except ValueError: cmd = ['/usr/bin/apt-cache', '--no-all-versions', 'show', 'python3-all'] try: import subprocess p = subprocess.Popen(cmd, bufsize=1, shell=False, stdout=subprocess.PIPE) fd = p.stdout except ImportError: fd = os.popen(' '.join(cmd)) depends = None for line in fd: if line.startswith('Depends:'): depends = line.split(':', 1)[1].strip().split(',') fd.close() depends = [re.sub(r'\s*(\S+)[ (]?.*', r'\1', s) for s in depends] _supported_versions = depends default = _supported_versions.pop(_supported_versions.index(_default_version)) _supported_versions.sort() _supported_versions.append(default) if version_only: return [v[6:] for v in _supported_versions] else: return _supported_versions def default_version(version_only=False): global _default_version if not _default_version: _default_version = os.readlink('/usr/bin/python3') # consistency check debian_default = read_default('default-version') if not _default_version in (debian_default, os.path.join('/usr/bin', debian_default)): raise ValueError("the symlink /usr/bin/python3 does not point to the " "python3 default version. It must be reset " "to point to %s" % debian_default) _default_version = debian_default if version_only: return _default_version[6:] else: return _default_version def requested_versions(vstring, version_only=False): global _default_version default_version() versions = None vinfo = parse_versions(vstring) supported = supported_versions(version_only=True) if len(vinfo) == 1: versions = vinfo['versions'].intersection(supported) vl = [] for version in versions: vl.append(version) try: default = vl.pop(vl.index(_default_version[6:])) except: default = '' vl.sort() if default: vl.append(default) else: raise ValueError('No supported python3 versions in version string') if not versions: raise ValueError('empty set of versions') if version_only: return vl else: return ['python%s' % v for v in vl] def installed_versions(version_only=False): import glob supported = supported_versions() versions = [os.path.basename(s) for s in glob.glob('/usr/bin/python3.[0-9]') + glob.glob('/usr/bin/python3.[0-9][0-9]') if os.path.basename(s) in supported] versions.sort() if version_only: return [v[6:] for v in versions] else: return versions def minmax_supported_version(minmax, version_only=False): supported_versions_list = supported_versions(True) version = minmax(version_to_tuple(ver) for ver in supported_versions_list) version_str = '%d.%d' % version if version_only: return version_str else: return 'python' + version_str class ControlFileValueError(ValueError): pass class MissingVersionValueError(ValueError): pass def extract_pyversion_attribute(fn, pkg): """read the debian/control file, extract the X-Python3-Version field.""" version = None sversion = None section = None with open(fn, encoding='utf-8') as controlfile: lines = [line.strip() for line in controlfile] for line in lines: if line == '' and section != None: if pkg == 'Source': break section = None elif line.startswith('Source:'): section = 'Source' elif line.startswith('Package: ' + pkg): section = pkg elif line.lower().startswith('x-python3-version:'): if section != 'Source': raise ValueError('attribute X-Python3-Version not in Source section') sversion = line.split(':', 1)[1].strip() if section is None: raise ControlFileValueError('not a control file') if pkg == 'Source': if sversion is None: raise MissingVersionValueError('no X-Python3-Version in control file') return sversion return version ''' def requested_versions_bis(vstring, version_only=False): versions = [] py_supported_short = supported_versions(version_only=True) for item in vstring.split(','): v=item.split('-') if len(v)>1: if not v[0]: v[0] = py_supported_short[0] if not v[1]: v[1] = py_supported_short[-1] for ver in py_supported_short: try: if version_cmp(ver,v[0]) >= 0 \ and version_cmp(ver,v[1]) <= 0: versions.append(ver) except ValueError: pass else: if v[0] in py_supported_short: versions.append(v[0]) versions.sort(version_cmp) if not versions: raise ValueError('empty set of versions') if not version_only: versions=['python'+i for i in versions] return versions ''' def main(): from optparse import OptionParser usage = '[-v] [-h] [-d|--default] [-s|--supported] [-i|--installed] ' '[-r|--requested <version string>|<control file>]' parser = OptionParser(usage=usage) parser.add_option('-d', '--default', help='print the default python3 version', action='store_true', dest='default') parser.add_option('-s', '--supported', help='print the supported python3 versions', action='store_true', dest='supported') parser.add_option('-r', '--requested', help='print the python3 versions requested by a build; ' 'the argument is either the name of a control file ' 'or the value of the X-Python3-Version attribute', action='store_true', dest='requested') parser.add_option('-i', '--installed', help='print the installed supported python3 versions', action='store_true', dest='installed') parser.add_option('--min-supported', help='print the minimum supported python3 version', action='store_true', dest='minsupported') parser.add_option('--max-supported', help='print the maximum supported python3 version', action='store_true', dest='maxsupported') parser.add_option('-v', '--version', help='print just the version number(s)', default=False, action='store_true', dest='version_only') opts, args = parser.parse_args() program = os.path.basename(sys.argv[0]) if opts.default and len(args) == 0: try: print(default_version(opts.version_only)) except ValueError as msg: print("%s:" % program, msg) sys.exit(1) elif opts.supported and len(args) == 0: print(' '.join(supported_versions(opts.version_only))) elif opts.installed and len(args) == 0: print(' '.join(installed_versions(opts.version_only))) elif opts.minsupported and len(args) == 0: print(minmax_supported_version(min, opts.version_only)) elif opts.maxsupported and len(args) == 0: print(minmax_supported_version(max, opts.version_only)) elif opts.requested and len(args) <= 1: if len(args) == 0: versions = 'debian/control' else: versions = args[0] try: if os.path.isfile(versions): fn = versions try: vstring = extract_pyversion_attribute(fn, 'Source') vs = requested_versions(vstring, opts.version_only) except ControlFileValueError: sys.stderr.write("%s: not a control file: %s, " % (program, fn)) sys.exit(1) except MissingVersionValueError: sys.stderr.write("%s: no X-Python3-Version in control " "file, using supported versions\n" % program) vs = supported_versions(opts.version_only) else: vs = requested_versions(versions, opts.version_only) print(' '.join(vs)) except ValueError as msg: sys.stderr.write("%s: %s\n" % (program, msg)) sys.exit(1) else: sys.stderr.write("usage: %s %s\n" % (program, usage)) sys.exit(1) if __name__ == '__main__': main()
Upload File
Create Folder