Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: setup.py

Issue 415033003: A few additional fixes for infra refactoring in testing_support (Closed) Base URL: https://chromium.googlesource.com/infra/testing/testing_support.git@master
Patch Set: Fix imports and setup.py Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | testing_support/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 try: 6 from setuptools import setup, find_packages
7 from setuptools import setup
8 except ImportError:
9 from distutils.core import setup
10 7
11 import ast 8 import ast
12 9
13 10
14 def read_vars(path): 11 def read_vars(path):
15 ret = {} 12 ret = {}
16 with open(path) as f: 13 with open(path) as f:
17 for n in ast.walk(ast.parse(f.read())): 14 for n in ast.walk(ast.parse(f.read())):
18 if isinstance(n, ast.Module): 15 if isinstance(n, ast.Module):
19 ret['__doc__'] = ast.get_docstring(n) 16 ret['__doc__'] = ast.get_docstring(n)
20 elif isinstance(n, ast.Assign): 17 elif isinstance(n, ast.Assign):
21 if isinstance(n.targets[0], ast.Name) and isinstance(n.value, ast.Str): 18 if isinstance(n.targets[0], ast.Name) and isinstance(n.value, ast.Str):
22 ret[n.targets[0].id] = n.value.s 19 ret[n.targets[0].id] = n.value.s
23 return ret 20 return ret
24 21
25 22
26 NAME = 'testing_support' 23 NAME = 'testing_support'
27 VARS = read_vars(NAME + '/__init__.py') 24 VARS = read_vars(NAME + '/__init__.py')
28 25
29 26
30 setup( 27 setup(
31 name=NAME, 28 name=NAME,
32 version=VARS['__version__'], 29 version=VARS['__version__'],
33 description=VARS['__doc__'].splitlines()[0], 30 description=VARS['__doc__'].splitlines()[0],
34 long_description=open('README.md').read(), 31 long_description=open('README.md').read(),
35 author=VARS['__author__'], 32 author=VARS['__author__'],
36 author_email=VARS['__email__'], 33 author_email=VARS['__email__'],
37 url=VARS['__url__'], 34 url=VARS['__url__'],
38 packages=[NAME], 35 packages=find_packages()
39 ) 36 )
OLDNEW
« no previous file with comments | « no previous file | testing_support/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698