#! /usr/bin/python3 # !/usr/local/bin/python deprecated for Raspberry Pi # by D@CC on 2022CMar19 #################################################################### # first line (shebang) must be #! /usr/bin/python3 # # place IX_textnames.py nShowDefs.py and the package into Desktop # # # # Usage: >$ cd Desktop/IX # # >sudo chmod +x nShowDefs.py # # >$ python3 ../nShowDefs.py < ../adcRead_pkg.py # # or: >$ cd Desktop # # >$ ./nShowDefs.py < adcRead_pkg.py # # NB In terminal, the above should list the names of the # # files that exist in the package named in stdin. # # and the lines that contain "def " # # # # but due to the Unix trick line 1 "#!/usr... # # and the last line if __name__ ... # # the command line below works (afer chmod ...): # # >$ ./nShowDefs.py ' # the IX Marker is different mlen = len(marker) # file names appear after markers def names(): print('#::: Be sure to precede the Pkg name with a "<".') print("#::: nShowDefs also reports the def s") if True: for line in sys.stdin.readlines( ): # for all input lines #print("before first line") #if line=="": break #if line==None: break markIn=line[0:mlen] if(line[:mlen]== marker): # is it a marker line llen=len(line) filename=line[mlen:llen-1] # get filename without LF print(filename) else: #DC special if (line[0:1]=="#") : #DC ignore comment lines continueDoh=True #DC else: #DC if line.find("def ")==-1 : #DC special #not found #DC continueDoh=True #DC else: #DC #found def #DC if line.find("#def ")==-1 : #DC #not found #DC llen=len(line) #DC pline=line[:llen-1] #DC #pline=line #DC print(pline) #DC special #if end #DC #if end #DC special #if end #for end print("#::: end of list of nShowDefs.py") #end def names.py if __name__ == '__main__' : names( ) #end of nShowDefs.py