Spaces:
Sleeping
Sleeping
Commit
·
2efd5b6
1
Parent(s):
cbdc3db
Upload setup.py
Browse files
setup.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
import os
|
3 |
+
import re
|
4 |
+
from setuptools import setup
|
5 |
+
|
6 |
+
|
7 |
+
def read(filename):
|
8 |
+
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
|
9 |
+
file_content = f.read()
|
10 |
+
return file_content
|
11 |
+
|
12 |
+
|
13 |
+
def get_requirements():
|
14 |
+
requirements = []
|
15 |
+
for requirement in read('requirements.txt').splitlines():
|
16 |
+
if requirement.startswith('git+') or requirement.startswith('svn+') or requirement.startswith('hg+'):
|
17 |
+
parsed_requires = re.findall(r'#egg=([\w\d\.]+)-([\d\.]+)$', requirement)
|
18 |
+
if parsed_requires:
|
19 |
+
package, version = parsed_requires[0]
|
20 |
+
requirements.append(f'{package}=={version}')
|
21 |
+
else:
|
22 |
+
print('WARNING! For correct matching dependency links need to specify package name and version'
|
23 |
+
'such as <dependency url>#egg=<package_name>-<version>')
|
24 |
+
else:
|
25 |
+
requirements.append(requirement)
|
26 |
+
return requirements
|
27 |
+
|
28 |
+
|
29 |
+
def get_links():
|
30 |
+
return [
|
31 |
+
requirement for requirement in read('requirements.txt').splitlines()
|
32 |
+
if requirement.startswith('git+') or requirement.startswith('svn+') or requirement.startswith('hg+')
|
33 |
+
]
|
34 |
+
|
35 |
+
|
36 |
+
def get_version():
|
37 |
+
""" Get version from the package without actually importing it. """
|
38 |
+
init = read('deepfloyd_if/__init__.py')
|
39 |
+
for line in init.split('\n'):
|
40 |
+
if line.startswith('__version__'):
|
41 |
+
return eval(line.split('=')[1])
|
42 |
+
|
43 |
+
|
44 |
+
setup(
|
45 |
+
name='deepfloyd_if',
|
46 |
+
version=get_version(),
|
47 |
+
author='DeepFloyd, StabilityAI',
|
48 |
+
author_email='[email protected]',
|
49 |
+
description='DeepFloyd-IF (Imagen Free)',
|
50 |
+
packages=['deepfloyd_if', 'deepfloyd_if/model', 'deepfloyd_if/modules', 'deepfloyd_if/pipelines',
|
51 |
+
'deepfloyd_if/resources'],
|
52 |
+
package_data={'deepfloyd_if/resources': ['*.png', '*.npy', '*.npz']},
|
53 |
+
install_requires=get_requirements(),
|
54 |
+
dependency_links=get_links(),
|
55 |
+
long_description=read('README.md'),
|
56 |
+
long_description_content_type='text/markdown',
|
57 |
+
)
|