Пример #1
0
#!/usr/bin/env python3

#------------------------------------------------------
#       get password
#------------------------------------------------------
import sys, os
from pathlib import Path
home = str(Path.home())
AutoPassDirc = home + '/Documents/AutoPassword'
sys.path.insert(0, AutoPassDirc)
import password as pw

username = pw.GetAutoPasswd('git', 'username').get()
password = pw.GetAutoPasswd('git', 'password').get()
project = pw.GetAutoPasswd('git', 'project').get()
#------------------------------------------------------

import datetime, os
time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
gitadd = "git add .;"
gitcom = "git commit -m " + "\"" + time + "\";"
gitpus = "git push https://" + username + ":" + password + "@" + project + " --force;"

os.system(gitadd + gitcom + gitpus)
Пример #2
0
    license='LICENSE.md',
    description='{description}',
    long_description=open('README.md',encoding="utf8").read(),
    long_description_content_type="text/markdown",
    install_requires={install_requires},
    python_requires='>=3.5',
    url = "https://github.com/HengyueLi/easycon",
)
'''.format(name=name,
           scripts=str(scripts),
           version=datetime.datetime.now().strftime("%Y.%m.%d.%H%M"),
           description=description,
           install_requires=[
               i for i in open('requirements.txt').read().split('\n')
               if len(i) > 1
           ])

os.system('rm -rf {}/*'.format(dist))
os.system('rm -rf setup.py')
with open('setup.py', 'w') as f:
    f.write(setupcontext)
os.system('{} setup.py sdist'.format(python))
#---------------------------------------
# upload with username&password
command = "twine upload dist/* -u {username} -p {password}".format(
    username=pw.GetAutoPasswd('pip', 'username').get(),
    password=pw.GetAutoPasswd('pip', 'password').get())
os.system(command)
#---------------------------------------
os.system('rm -rf dist setup.py *egg-info*')