@@ -83,13 +83,13 @@ def update_fixup_scripts(library):
8383 )
8484
8585for library in get_staging_dirs (default_version = firestore_default_version , sub_directory = "firestore" ):
86- s .move (library / f"google/cloud/firestore_{ library .name } " , excludes = [f"__init__.py" , "**/gapic_version.py" ])
86+ s .move (library / f"google/cloud/firestore_{ library .name } " , excludes = [f"__init__.py" , "**/gapic_version.py" , "noxfile.py" ])
8787 s .move (library / f"tests/" , f"tests" )
8888 update_fixup_scripts (library )
8989 s .move (library / "scripts" )
9090
9191for library in get_staging_dirs (default_version = firestore_admin_default_version , sub_directory = "firestore_admin" ):
92- s .move (library / f"google/cloud/firestore_admin_{ library .name } " , excludes = [f"__init__.py" , "**/gapic_version.py" ])
92+ s .move (library / f"google/cloud/firestore_admin_{ library .name } " , excludes = [f"__init__.py" , "**/gapic_version.py" , "noxfile.py" ])
9393 s .move (library / f"tests" , f"tests" )
9494 update_fixup_scripts (library )
9595 s .move (library / "scripts" )
@@ -127,7 +127,7 @@ def update_fixup_scripts(library):
127127 s .move (
128128 library / f"google/cloud/bundle" ,
129129 f"google/cloud/firestore_bundle" ,
130- excludes = ["**/gapic_version.py" ],
130+ excludes = ["**/gapic_version.py" , "noxfile.py" ],
131131 )
132132 s .move (library / f"tests" , f"tests" )
133133
@@ -151,133 +151,6 @@ def update_fixup_scripts(library):
151151
152152python .py_samples (skip_readmes = True )
153153
154- # ----------------------------------------------------------------------------
155- # Customize noxfile.py
156- # ----------------------------------------------------------------------------
157-
158- def place_before (path , text , * before_text , escape = None ):
159- replacement = "\n " .join (before_text ) + "\n " + text
160- if escape :
161- for c in escape :
162- text = text .replace (c , '\\ ' + c )
163- s .replace ([path ], text , replacement )
164-
165- system_emulated_session = """
166- @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
167- def system_emulated(session):
168- import subprocess
169- import signal
170-
171- try:
172- # https://github.com/googleapis/python-firestore/issues/472
173- # Kokoro image doesn't have java installed, don't attempt to run emulator.
174- subprocess.call(["java", "--version"])
175- except OSError:
176- session.skip("java not found but required for emulator support")
177-
178- try:
179- subprocess.call(["gcloud", "--version"])
180- except OSError:
181- session.skip("gcloud not found but required for emulator support")
182-
183- # Currently, CI/CD doesn't have beta component of gcloud.
184- subprocess.call(
185- ["gcloud", "components", "install", "beta", "cloud-firestore-emulator",]
186- )
187-
188- hostport = "localhost:8789"
189- session.env["FIRESTORE_EMULATOR_HOST"] = hostport
190-
191- p = subprocess.Popen(
192- [
193- "gcloud",
194- "--quiet",
195- "beta",
196- "emulators",
197- "firestore",
198- "start",
199- "--host-port",
200- hostport,
201- ]
202- )
203-
204- try:
205- system(session)
206- finally:
207- # Stop Emulator
208- os.killpg(os.getpgid(p.pid), signal.SIGKILL)
209-
210- """
211-
212- place_before (
213- "noxfile.py" ,
214- "@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)\n "
215- "def system(session):" ,
216- system_emulated_session ,
217- escape = "()"
218- )
219-
220- # add system_emulated + mypy nox session
221- s .replace ("noxfile.py" ,
222- """nox.options.sessions = \[
223- "unit",
224- "system",""" ,
225- """nox.options.sessions = [
226- "unit",
227- "system_emulated",
228- "system",
229- "mypy",""" ,
230- )
231-
232- s .replace (
233- "noxfile.py" ,
234- """\" --quiet\" ,
235- f\" --junitxml=system_\{session.python\}_sponge_log.xml\" ,
236- system_test""" ,
237- """\" --verbose\" ,
238- f\" --junitxml=system_{session.python}_sponge_log.xml\" ,
239- system_test""" ,
240- )
241-
242- s .replace (
243- "noxfile.py" ,
244- """\
245- BLACK_VERSION = "black\[jupyter\]==23.7.0"
246- """ ,
247- """\
248- PYTYPE_VERSION = "pytype==2020.7.24"
249- BLACK_VERSION = "black[jupyter]==23.7.0"
250- """ ,
251- )
252-
253- s .replace (
254- "noxfile.py" ,
255- """\
256- @nox.session\(python=DEFAULT_PYTHON_VERSION\)
257- def lint_setup_py\(session\):
258- """ ,
259- '''\
260- @nox.session(python="3.7")
261- def pytype(session):
262- """Verify type hints are pytype compatible."""
263- session.install(PYTYPE_VERSION)
264- session.run("pytype",)
265-
266-
267- @nox.session(python=DEFAULT_PYTHON_VERSION)
268- def mypy(session):
269- """Verify type hints are mypy compatible."""
270- session.install("-e", ".")
271- session.install("mypy", "types-setuptools")
272- # TODO: also verify types on tests, all of google package
273- session.run("mypy", "-p", "google.cloud.firestore", "--no-incremental")
274-
275-
276- @nox.session(python=DEFAULT_PYTHON_VERSION)
277- def lint_setup_py(session):
278- ''' ,
279- )
280-
281154s .shell .run (["nox" , "-s" , "blacken" ], hide_output = False )
282155
283156s .replace (
@@ -289,5 +162,3 @@ def lint_setup_py(session):
289162
290163# Setup service account credentials.""" ,
291164)
292-
293- s .replace ("noxfile.py" , "\" pytest-asyncio\" " , "\" pytest-asyncio==0.21.2\" " )
0 commit comments