How many xib and js scripts (python) and xibpython are used in the app?

Source: Internet
Author: User

How many xib and js scripts (python) and xibpython are used in the app?
Checks how many xib and js scripts are used by the app (python) by Wu xueying
#! /Usr/bin/env python
# Coding = UTF-8
Importos, sys

DefcountTargetFile (targetDir ):
ResultStr =''
TargetTypes = ['. nib','. M', '. js']
For targetType in targetTypes:
TargetCount = 0
For root, dirs, filesin OS. walk (targetDir ):
For file in files:
If file. endswith (targetType ):
Print OS. path. join (root, file)
TargetCount + = 1
OneResult = 'Type = '+ targetType +', target count = '+ str (targetCount)
Print oneResult
ResultStr + = oneResult + '\ N'
Return resultStr

Defdeal (baseDir, filename ):
Print 'process file: '+ baseDir + filename
TmpDir = OS. getcwd () + '/unzip_folders/' + filename. replace ('','_')
Print tmpDir
Try:
OS. mkdir (tmpDir)
ZipFile = tmpDir + '/' + 'tmp.zip'
Command = 'cp' + baseDir + filename. replace ('', '\') +'' + zipFile
OS. system (command)
Command = 'unzip' + zipFile + '-d' + tmpDir
Print command
OS. system (command)
Failed t OSError:
Print 'file exist, ignore'

ResultStr = countTargetFile (tmpDir + '/payload ')
File = open (tmpDir. replace ('. ipa', '') + '_result.txt ', 'w ')
File. write (filename + ': \ n ')
File. write (resultStr)
File. write ('\ n ')
File. close ()

Defprocess ():
BaseDir = OS. getcwd ()
TargetFiles = OS. listdir ('./ipa_folders ')
Print targetFiles
For oneFile in targetFiles:
If oneFile. endswith ('. ipa '):
Deal (baseDir + '/ipa_folders/', oneFile)

If _ name _ = '_ main __':
Process () print 'over'

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.