91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 55KB
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-06-12
  • 語(yǔ)言: 其他
  • 標(biāo)簽: protobuf??

資源簡(jiǎn)介

linux protobuf linux protobuf linux protobuf linux protobuf

資源截圖

代碼片段和文件信息

#!?/usr/bin/python
#
#?See?README?for?usage?instructions.
import?sys
import?os
import?subprocess

#?We?must?use?setuptools?not?distutils?because?we?need?to?use?the
#?namespace_packages?option?for?the?“google“?package.
try:
??from?setuptools?import?setup?Extension
except?ImportError:
??try:
????from?ez_setup?import?use_setuptools
????use_setuptools()
????from?setuptools?import?setup?Extension
??except?ImportError:
????sys.stderr.write(
????????“Could?not?import?setuptools;?make?sure?you?have?setuptools?or?“
????????“ez_setup?installed.\n“)
????raise
from?distutils.command.clean?import?clean?as?_clean
from?distutils.command.build_py?import?build_py?as?_build_py
from?distutils.spawn?import?find_executable

maintainer_email?=?“protobuf@googlegroups.com“

#?Find?the?Protocol?Compiler.
if?os.path.exists(“../src/protoc“):
??protoc?=?“../src/protoc“
elif?os.path.exists(“../src/protoc.exe“):
??protoc?=?“../src/protoc.exe“
elif?os.path.exists(“../vsprojects/Debug/protoc.exe“):
??protoc?=?“../vsprojects/Debug/protoc.exe“
elif?os.path.exists(“../vsprojects/Release/protoc.exe“):
??protoc?=?“../vsprojects/Release/protoc.exe“
else:
??protoc?=?find_executable(“protoc“)

def?generate_proto(source):
??“““Invokes?the?Protocol?Compiler?to?generate?a?_pb2.py?from?the?given
??.proto?file.??Does?nothing?if?the?output?already?exists?and?is?newer?than
??the?input.“““

??output?=?source.replace(“.proto“?“_pb2.py“).replace(“../src/“?““)

??if?(not?os.path.exists(output)?or
??????(os.path.exists(source)?and
???????os.path.getmtime(source)?>?os.path.getmtime(output))):
????print?“Generating?%s...“?%?output

????if?not?os.path.exists(source):
??????sys.stderr.write(“Can‘t?find?required?file:?%s\n“?%?source)
??????sys.exit(-1)

????if?protoc?==?None:
??????sys.stderr.write(
??????????“protoc?is?not?installed?nor?found?in?../src.??Please?compile?it?“
??????????“or?install?the?binary?package.\n“)
??????sys.exit(-1)

????protoc_command?=?[?protoc?“-I../src“?“-I.“?“--python_out=.“?source?]
????if?subprocess.call(protoc_command)?!=?0:
??????sys.exit(-1)

def?MakeTestSuite():
??#?This?is?apparently?needed?on?some?systems?to?make?sure?that?the?tests
??#?work?even?if?a?previous?version?is?already?installed.
??if?‘google‘?in?sys.modules:
????del?sys.modules[‘google‘]

??generate_proto(“../src/google/protobuf/unittest.proto“)
??generate_proto(“../src/google/protobuf/unittest_custom_options.proto“)
??generate_proto(“../src/google/protobuf/unittest_import.proto“)
??generate_proto(“../src/google/protobuf/unittest_mset.proto“)
??generate_proto(“../src/google/protobuf/unittest_no_generic_services.proto“)
??generate_proto(“google/protobuf/internal/more_extensions.proto“)
??generate_proto(“google/protobuf/internal/more_messages.proto“)

??import?unittest
??import?google.protobuf.internal.generator_test?????as?generator_test
??import?google.protobuf.internal.descriptor_test????as?descriptor_test
??import?google.protobuf.internal.reflection_test????as?reflection_test
??import?google.pr

評(píng)論

共有 條評(píng)論