Skip to content

Commit c68b984

Browse files
committed
Add auto build with user and password
1 parent 7be8865 commit c68b984

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

eggdriver/pypi.py

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
from eggdriver.resources import installFromRequests, sysCommand, py
1+
from eggdriver.resources import installFromRequests, sysCommand, py, white
22

33
defaultVersion = '0.0.'
44

5-
"""
5+
def build(autoVersion = True, baseVersion = defaultVersion):
6+
"""Build and upload a PyPI package release
7+
68
FUNCTION build()
7-
Build and upload a pypi package release
89
910
In Windows is equal to type in the console the following lines:
1011
py -m build --sdist
1112
py -m build --wheel
1213
py -m twine check dist/*
13-
py -m twine upload dist/*
14+
py -m twine upload -u {user} -p {password} dist/*
1415
"""
15-
def build(autoVersion = True, baseVersion = defaultVersion):
16-
"""Build and upload a pypi package release"""
1716
installFromRequests(["setuptools", "twine", "build"], False)
1817
if autoVersion:
1918
setup = py.getLines("setup")
@@ -27,10 +26,31 @@ def build(autoVersion = True, baseVersion = defaultVersion):
2726
sysCommand("-m build --sdist")
2827
sysCommand("-m build --wheel")
2928
sysCommand("-m twine check dist/*")
30-
sysCommand("-m twine upload dist/*")
29+
try:
30+
from eggconfig import pypi as info
31+
user = info["user"]
32+
password = info["password"]
33+
sysCommand(f"-m twine upload -u {user} -p {password} dist/*")
34+
except ImportError:
35+
print(white + """Please create a eggconfig.py file in your current directory and write the following lines
36+
37+
pypi = {
38+
"user" : "{your PyPI user or "__token__"}",
39+
"password" : "{your PyPI password or token}"
40+
}
41+
""")
3142

3243
def buildEggdriver(autoVersion = True, baseVersion = defaultVersion):
33-
"""Build and upload a eggdriver release"""
44+
"""Build and upload a eggdriver release to PyPI
45+
46+
FUNCTION buildEggdriver()
47+
48+
In Windows is equal to type in the console the following lines
49+
py -m build --sdist
50+
py -m build --wheel
51+
py -m twine check dist/*
52+
py -m twine upload -u {user} -p {password} dist/{version}dist/eggdriver-{version}.tar.gz
53+
"""
3454
installFromRequests(["setuptools", "twine", "build"], False)
3555
if autoVersion:
3656
setup = py.getLines("setup")
@@ -47,4 +67,16 @@ def buildEggdriver(autoVersion = True, baseVersion = defaultVersion):
4767
sysCommand("-m build --sdist")
4868
sysCommand("-m build --wheel")
4969
sysCommand("-m twine check dist/*")
50-
sysCommand("-m twine upload dist/*")
70+
try:
71+
from eggconfig import pypi as info
72+
user = info["user"]
73+
password = info["password"]
74+
sysCommand(f"-m twine upload -u {user} -p {password} dist/eggdriver-{v}.tar.gz")
75+
except ImportError:
76+
print(white + """Please create a eggconfig.py file in your current directory and write the following lines
77+
78+
pypi = {
79+
"user" : "{your PyPI user or "__token__"}",
80+
"password" : "{your PyPI password or token}"
81+
}
82+
""")

eggdriver/resources/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def login():
1515
logged = True
1616
print(white + "Done")
1717
except ImportError:
18-
print(white + "Please create a eggconfig.py file in your current directory and execute $register command into EggCOnsole")
18+
print(white + "Please create a eggconfig.py file in your current directory and execute $register command into EggConsole")
1919
except:
2020
print(white + "Error")
2121
return logged

0 commit comments

Comments
 (0)