Re: CLI framework using python

2014-10-09 Thread Unix SA
Hello,

Go for Optparse.. Look at below docs on how to use it.

http://pymotw.com/2/optparse/

Regards,
DJ

On Thu, Oct 9, 2014 at 5:50 PM, vijna...@gmail.com wrote:

 Hi,

 I need to develop a python CLI framework.

 For example if i need to set an ip address in linux:

 ifconfig eth0 172.16.25.125

 I should be able to use python to do the above.

 1. The user will execute a python script to which i will pass the params
 eth0 and ip address (something like ifconf.py  eth0 172.16.25.125)

 2. Within the script i grab the params and do something to the effect of
 user executing 'ifconfig eth0 172.16.25.125' from the shell.

 3. There are other such commands for which i will be using python scripts.
 I came across pyCLI, but it doesn't have much documentation, so couldn't
 figure out how to move forward.

 4. The CLI framework needs to reuse code so i didn't want to use pure
 python and develop a framework from scratch. Rather use something like
 pyCLI/CLIFF.

 The problem is lack of documentation with examples on how to use the above.

 Any guidance would be greatly appreciated.

 Regards  Thanks,
 Vij

 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


please suggest me best way to learn REST API call with CLI

2014-09-27 Thread Unix SA
Hello,

I am intermediate to python and i am familier with OOP, but sometime i lost
some where looking at OOP in class and objects  :(

I am looking at https://github.com/pulp/pulp ..

basically it uses okaara to generate CLI and calls API.


so for example if i run pulp-admin -u admin -p admin rpm repo list it
produces list of all repositories ...

now i want to write similar thing .. but without producing all repository i
just want to list single repo and below is the API for that ..

http://pulp-dev-guide.readthedocs.org/en/pulp-2.2/integration/rest-api/repo/retrieval.html

Not sure what's the best way to write it ... i want to do in OO way.. i
know how to use requests/httplib module and generate data and produce
output .

but i am not able to build URL ...

can someone help to suggest best way to learn and write it ?

Regards,
DJ
-- 
https://mail.python.org/mailman/listinfo/python-list


Need help in writing some code so i can re-use it in every module or class

2014-02-26 Thread Unix SA
Hello Experts,

I have requirement, like i want to use below command in python script.

command --username username --password password  Command line
arguments

now my requirement is i want to write some class so i can re-use command
--username username --password password part via importing as module
or class  .. and re-use that in other module or classes .. so i dont have
to write that in every module or classes ..

Now why i wan to do this is ... currently command we are using is going
to change in near future to command1, so i dont have go to every module
and change that command if i have written single module or class and re-use
it in other ?

Hope i am clear enough to describe my issue?

any suggestions ?

Regards,
DJ
-- 
https://mail.python.org/mailman/listinfo/python-list


Need help with file object

2013-12-12 Thread Unix SA
Hello,

I am facing some issue when copying or moving file

f=open('/tmp/file1')
s=open('/tmp/file2')

for line in f:
  if 'match' not in line:
 s.write(line)

import shutil
shutil.move(s, f)

With above prog I am getting error
TypeError: coercing to Unicode: need sting or buffer, file found

What that means and how I can resolve it.

Regards,
Dj
-- 
https://mail.python.org/mailman/listinfo/python-list


New Project for rpm spec file creation

2013-12-07 Thread Unix SA
Hello Guys,

I am starting new project on github for rpm spec file creation .. currently
repository is empty and i am looking for ideas from the people who are
experts in creating rpms for different applications 

please share your ideas to me .. . currently what i know is i can have some
template file for .SPEC file and i can ask some inputs from users and
update that template file .. but looks like there are lot of template i
will have to look in .. so if you got any better idea, please clone my
repository and help to contribute.. .. or just reply back with your ideas..

Thanks in advance.

https://github.com/dhajoshi/rpm-spec-generator

Regards,
DJ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python application for rpm creation

2013-11-29 Thread Unix SA
Hello,

Thanks Runge,

I am not looking for tool which can help to create package for python code,
but i am looking for tool which creates package or SPEC file for all kind
of lib it's C or NET, or JAVA or anything.

Regards,
DJ


On Wed, Nov 27, 2013 at 2:41 PM, Matthias Runge mru...@matthias-runge.dewrote:

 On 11/27/2013 03:28 AM, Amit Saha wrote:
  On Wed, Nov 27, 2013 at 1:39 AM, Unix SA d.josh...@gmail.com wrote:
 
  Sounds to me more like he is looking to package some other in house
  software, as opposed to packaging python specific libraries, etc..
 
  - Yes, This is exactly i am looking at
 
 
  Doing an apt-cache search on my Ubuntu desktop results with a project,
  Spectacle, coincidentally written in Python. (I haven't really looked
  into
  it):
  http://meego.gitorious.org/meego-developer-tools/spectacle
 
  this looks useful, i shall looking to this... or may be try myself
 writing
  something.
 
  if you guys ( others ) got something else for Redhat Linux rpm creation
 do
  let me know.
 
  I played with creating a RPM SPEC file generator for Sphinx
 documentation:
  https://github.com/amitsaha/sphinx_doc_packaging
 
  It's written in Python, so perhaps may help with you a starting point.
 
  Best,
  Amit.
 
 
 In Fedora (and IMHO in EPEL, too) there is a package named pyp2rpm. This
 is quite handy. It fetches sources from pypi, writes a basic SPEC file,
 which might need minor tweaks, but in general, it really saves you time.

 Matthias
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python application for rpm creation

2013-11-26 Thread Unix SA
 Sounds to me more like he is looking to package some other in house
software, as opposed to packaging python specific libraries, etc..

- Yes, This is exactly i am looking at

 Doing an apt-cache search on my Ubuntu desktop results with a project,
Spectacle, coincidentally written in Python. (I haven't really looked 
into it):
 http://meego.gitorious.org/meego-developer-tools/spectaclehttp://meego.gitorious.org/meego-developer-tools/spectacle

this looks useful, i shall looking to this... or may be try myself writing
something.

if you guys ( others ) got something else for Redhat Linux rpm creation do
let me know.

Regards,
DJ






On Mon, Nov 25, 2013 at 10:57 PM, Andrew Heagle and...@logaan.com wrote:

 On Mon, Nov 25, 2013 at 9:17 AM, Unix SA d.josh...@gmail.com wrote:

 Hello guys,

 Probably not right forum but I thought I should get some suggestions.

 I am looking for some tool written in python which can help users to
 create rpm spec files and later help to build rpms, this will be for users
 who are not aware of what spec file is and how to.create rpm.

 Anyone knows such tool? It will be great if has gui.

 Regards,
 Dj

 Sounds to me more like he is looking to package some other in house
 software, as opposed to packaging python specific libraries, etc...

 I think you can just provide a blank spec file for them to 'fill in the
 blanks', however, using a GUI would be tricky since some parts of the spec
 file you typically wouldn't be able to complete until after attempting to
 build a few times (eg, %file section).

 Doing an apt-cache search on my Ubuntu desktop results with a project,
 Spectacle, coincidentally written in Python. (I haven't really looked into
 it):
 http://meego.gitorious.org/meego-developer-tools/spectacle

 When you have your spec files made, I'd recommend using this service to
 build your RPMS: https://build.opensuse.org/


 Regards,
 Andrew

-- 
https://mail.python.org/mailman/listinfo/python-list


Python application for rpm creation

2013-11-25 Thread Unix SA
Hello guys,

Probably not right forum but I thought I should get some suggestions.

I am looking for some tool written in python which can help users to create
rpm spec files and later help to build rpms, this will be for users who are
not aware of what spec file is and how to.create rpm.

Anyone knows such tool? It will be great if has gui.

Regards,
Dj
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python application for rpm creation

2013-11-25 Thread Unix SA
Hey,

sorry, this is something new for me and i am looking if something is
already developed, btw i am not looking for python module creation packages
.. what i am looking is for ex .. my users have their code written in C or
Java or any other lang and they want to package it in Linux RPM and for
that is that any tool which can help to create SPEC file ?//

i am aware of tito.. which can help me for building RPM.. but before that i
am looking for tool to create spec file.

Regards,
DJ


On Mon, Nov 25, 2013 at 10:12 PM, Terry Reedy tjre...@udel.edu wrote:

 On 11/25/2013 9:17 AM, Unix SA wrote:

  Probably not right forum but I thought I should get some suggestions.

 I am looking for some tool written in python which can help users to
 create rpm spec files and later help to build rpms, this will be for
 users who are not aware of what spec file is and how to.create rpm.

 Anyone knows such tool? It will be great if has gui.


 What have you done already and why has it not worked?

 The distutils package has bdist-rpm command. Web search will give you more.

 --
 Terry Jan Reedy

 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list