summaryrefslogtreecommitdiffstats
path: root/product.py
blob: 1df01d5245184b41a8e03f7db3cdee2690a8ccf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
# product.py: product identification string
#
# Copyright 2003 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

import os

if os.access("/tmp/product/.buildstamp", os.R_OK):
    path = "/tmp/product/.buildstamp"
elif os.access("/.buildstamp", os.R_OK):
    path = "/.buildstamp"
elif os.environ.has_key("PRODBUILDPATH") and \
         os.access(os.environ["PRODBUILDPATH"], os.R_OK):
    path = os.environ["PRODBUILDPATH"]
else:
    path = None
    
productStamp = ""
productName = "anaconda"
productVersion = "bluesky"
productPath = "anaconda"
productArch = None
bugUrl = "your distribution provided bug reporting tool."

if path is not None:
    f = open(path, "r")
    lines = f.readlines()
    if len(lines) >= 3:
        productStamp = lines[0][:-1]
        productArch = productStamp[productStamp.index(".")+1:]
        productName = lines[1][:-1]
        productVersion = lines[2][:-1]
    if len(lines) >= 4:
	productPath = lines[3][:-1]
    if len(lines) >= 5:
        bugUrl = lines[4][:-1]

if os.environ.has_key("ANACONDA_PRODUCTNAME"):
    productName = os.environ["ANACONDA_PRODUCTNAME"]
if os.environ.has_key("ANACONDA_PRODUCTVERSION"):
    productVersion = os.environ["ANACONDA_PRODUCTVERSION"]
if os.environ.has_key("ANACONDA_PRODUCTPATH"):
    productPath = os.environ["ANACONDA_PRODUCTPATH"]
if os.environ.has_key("ANACONDA_PRODUCTARCH"):
    productArch = os.environ["ANACONDA_PRODUCTARCH"]
if os.environ.has_key("ANACONDA_BUGURL"):
    bugUrl = os.environ["ANACONDA_BUGURL"]

if productVersion == "development": # hack to transform for now
    productVersion = "rawhide"