Re: Renaming pythonXY packages to pythonX.Y (e.g. python39 to python3.9)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2020-04-30 at 01:10 +0200, Miro Hrončok wrote:
> On 30. 04. 20 1:07, Neal Gompa wrote:
> > > my usual mistake is where I do a stupid programming and do something like
> > > 
> > > ls -1 | awk '{split($0,a,"."); print a[1]}' | whatever I needed for just the names of rpms
> > > 
> > > which for most packages will give me the Name-Ver[.sion removed]. it is lazy script programming but it works often enough that my brain wants it to work all the time than doing something like
> > > 
> > > ls -1 *rpm | xargs rpm --qf='%{NAME}\n' -qp | whatever i needed for just the names of the rpms.
> > > 
> > Splitting on the second to last dash of an rpm file name will*always*
> > give you the name on the left side, and the version-release on the
> > right side, so I usually do a split that way.
> 
> I have this in my PATH (called pkgname):
> 
> #!/usr/bin/python3
> import fileinput
> 
> 
> for line in fileinput.input():
>      print('-'.join(line.split('-')[:-2]))

how about:

    print(line.rsplit("-", 2)[0])

?
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux